Profile Picture

sample code for line chart

Posted By Sharmila Kumari 14 Years Ago
Author
Message
Sharmila Kumari
Posted 14 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)

Group: Forum Members
Last Active: 14 Years Ago
Posts: 2, Visits: 1
Hi,
I am evaluating Neveron charts for .NET using WPF.Can you please provide me a sample code to render a line chart in wpf? I am not able to render the chart.below is my code.

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:wfi="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration"
xmlns:wf="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
xmlns:nevronchart="clr-namespace:Nevron.Chart.WinForm;assembly=Nevron.Chart.WinForm"

Title="MainWindow" Height="350" Width="525">










In code behind
NChartControl nChartControl1 = new NChartControl();

NChart chart = nChartControl1.Charts[0];
chart.BoundsMode = BoundsMode.Stretch;


nChartControl1.Charts.Add(chart);
chart.Width = 400;
chart.Depth = 400;


//setup axis y
NLinearScaleConfigurator scaleY = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator;

//setup axis x
NLinearScaleConfigurator scaleX = new NLinearScaleConfigurator();
scaleX.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back, ChartWallType.Floor };


chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = scaleX;

// add the line
NLineSeries line = (NLineSeries)chart.Series.Add(SeriesType.Line);
line.Name = "Line Series";
Random rn = new Random();
line.Values.Add(rn.Next(1, 1000));

//line.AddDataPoint(new NDataPoint(23, "A"));
//line.AddDataPoint(new NDataPoint(67, "B"));
//line.AddDataPoint(new NDataPoint(47, "C"));
//line.AddDataPoint(new NDataPoint(12, "D"));
//line.AddDataPoint(new NDataPoint(56, "E"));
//line.AddDataPoint(new NDataPoint(78, "F"));


line.LineSegmentShape = LineSegmentShape.Line;
line.DataLabelStyle.Visible = false;
line.MarkerStyle.Visible = false;
line.Legend.Mode = SeriesLegendMode.None;

line.SamplingMode = SeriesSamplingMode.Enabled;
line.SampleDistance = new NLength(1, NGraphicsUnit.Pixel);
chart.Series.Add(line);
nChartControl1.Refresh();

How can I add the chart to layoutroot in this???


Thanks an Regards




Similar Topics


Reading This Topic