我想描述的數學函數的圖表(正弦,對數,指數,...)在WPF中,我知道它只有兩個辦法:使用System.Windows的方式來描述的數學函數的圖表在WPF
1- .Forms.DataVisualization.Charting.Chart:
chart1.Series.Clear();
var series1 = new System.Windows.Forms.DataVisualization.Charting.Series
{
Name = "Series1",
Color = System.Drawing.Color.Green,
IsVisibleInLegend = false,
IsXValueIndexed = true,
ChartType = SeriesChartType.Line
};
this.chart1.Series.Add(series1);
for (int i=0; i < 100; i++)
{
series1.Points.AddXY(i, f(i));
}
chart1.Invalidate();
2-使用XAML代碼:
<Canvas HorizontalAlignment="Center" Name="PCanvas" VerticalAlignment="Center" Margin="26,23,327,418">
<Canvas.RenderTransform>
<ScaleTransform ScaleX="{Binding ElementName=SignalScaleSlider, Path=Value}" />
</Canvas.RenderTransform>
<Path Data="M 10,370 L 10,10 M 42,370 L 42,10 M 74,370 L 74,10 M 106,370 L 106,10 M 138,370 L 138,10 M 170,370 L 170,10
M 202,370 L 202,10 M 234,370 L 234,10 M 266,370 L 266,10 M 298,370 L 298,10
...
哪一個更好?
有沒有其他解決方案? tnx。
每個的特殊用途是什麼? – abdolah