How do I implement charts in WPF?

Solution
Using the template on this web site - stackoverflow.com/questions/33756255/create-a-math-plot-in-c-sharp-xam

.xaml

C#:
<Canvas x:Name="gCanvasPlot0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Margin="0,0,0,0"
Width="500"
Height="150" />

.cs

C#:
//------------------------------
private void AddPlot()
{
double dPI = Math.PI;

Polyline poXY = new Polyline {
Stroke = Brushes.Red
};
int iNumOfCycles = 3;
double dDeltaX = 0.01;
int iNumOfPoints0 = (int)(iNumOfCycles / dDeltaX);
for (int ii = 0; ii < iNumOfPoints0; ii++) {
double dX = ii * dDeltaX;
double dY = Math.Sin(2 * dPI * dX);
poXY.Points.Add(CorrespondingPoint(new Point(dX, dY), iNumOfCycles));
}
gCanvasPlot0.Children.Add(poXY);
}//AddPlot...
Please use code tags for multiline code, not inline code tags. Yes, this site is messed up because the iconography it uses for multiline code looks like HTML quote </>, while the inline code icon looks like StackOverflow's code blocks >_. I'll fix up the code above.

Good job with being persistent trying to figure out the problem to find a solution that works for the way you think!!!
 
Please use code tags for multiline code, not inline code tags. Yes, this site is messed up because the iconography it uses for multiline code looks like HTML quote </>, while the inline code icon looks like StackOverflow's code blocks >_. I'll fix up the code above.

Good job with being persistent trying to figure out the problem to find a solution that works for the way you think!!!
What is the multiline code icon? I cannot find it.
 
It's the first icon on the toolbar of this text reply area. It looks like: </>
 
It would be helpful if both "code" icons were adjacent. Also, it would be helpful if mousing over it stated, "multiline code" . Thanks!
 
I completely agree!
 
I've already given that feedback to the site owner a few months ago in the modertors chat room, but you could do so again in the Forum Feedback subforum.
 
Back
Top Bottom