[英]I am using WPF Toolkit to print a graph and The x axis is all smeared
I am using WPF Toolkit to print a graph. 我正在使用WPF工具包来打印图形。 Here how it's look like:
看起来像这样:
The x axis is all smeared. x轴全部被涂抹。 How can i change x axis?
如何更改X轴? for example axis with 5 unit interval.
例如具有5个单位间隔的轴。
Here is my code: 这是我的代码:
c# code : C#代码 :
string[] lines = System.IO.File.ReadAllLines("AnaloguData.txt");
List<KeyValuePair<string, double>> valueList = new List<KeyValuePair<string, double>>();
for (int i = 0; i < lines.Length; i++)
if(i %370==0)
{
string[] words = lines[i].Split('\t');
valueList.Add(new KeyValuePair<string, double>(words[0].ToString(), Convert.ToDouble(words[1])));
}
lineChart.DataContext = valueList;
xaml code : xaml代码 :
<Grid Height="921">
<chartingToolkit:Chart Name="lineChart" Title="" VerticalAlignment="Top" Height="254" Margin="0,0,-110,0">
<chartingToolkit:LineSeries DependentValuePath="Value" IndependentValuePath="Key" ItemsSource="{Binding}" IsSelectionEnabled="True" Margin="0,0,2,0"/>
</chartingToolkit:Chart>
<Grid>
Try to use following code to edit axis properties. 尝试使用以下代码来编辑轴属性。 (Note , I have used "charting" as namespace" instead of "chartingToolkit" )
(请注意,我已经使用“图表”作为名称空间”而不是“ chartingToolkit”)
<Grid>
<charting:Chart Name="lineChart" Title="" VerticalAlignment="Top" Height="254" Margin="0,0,-110,0">
<charting:LineSeries DependentValuePath="Value" IndependentValuePath="Key" ItemsSource="{Binding}" IsSelectionEnabled="True" Margin="0,0,2,0"/>
</chartingToolkit:Chart>
<charting:Chart.Title>
<TextBlock x:Name="Chart_Title" FontStyle="Normal" FontSize="16" FontWeight="Bold" Text="Ergebnisse" ></TextBlock>
</charting:Chart.Title>
<charting:Chart.Axes>
<charting:LinearAxis FontWeight="SemiBold" Orientation="X" >
<charting:LinearAxis.Title>
<TextBlock x:Name="X_Axis" Margin="0,5,0,0" FontStyle="Normal" FontSize="15" FontWeight="Bold" Text="Abgewickelte Länge in mm" ></TextBlock>
</charting:LinearAxis.Title>
</charting:LinearAxis>
<charting:LinearAxis Orientation="Y" >
<charting:LinearAxis.Title>
<TextBlock x:Name="Y_Axis" Margin="0,0,0,5" FontStyle="Normal" Text="Ausgewertete Größe" FontSize="15" FontWeight="Bold" ></TextBlock>
</charting:LinearAxis.Title>
</charting:LinearAxis>
</charting:Chart.Axes>
</charting:Chart>
</Grid>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.