Group: Forum Members
Last Active: 14 Years Ago
Posts: 2,
Visits: 1
|
Hi,
I am generating a line chart using ASP.NET,You can find the code below.I have total 10 points and I am specifying color property for each point.The output shows the line chart with different colors as I specified and that works well.But Now I apply line sampling.The chart does not show up any color which is specified.The same behavior is observed when color is applied to whole series.Can anyone please tell me why the chart is discarding color property when sampling is enabled? and what can I do in order to get the colors specified even after enabling line sampling??
NChart chart = NChartControl1.Charts[0]; chart.Width = 600; chart.Height = 300; NLineSeries line = new NLineSeries(); line.LineSegmentShape = LineSegmentShape.Line;
//line.FillStyle = new NColorFillStyle(Color.Red);
line.SamplingMode = SeriesSamplingMode.Enabled; line.SampleDistance = new NLength(2, NGraphicsUnit.Pixel);
NDataPoint dp1 = new NDataPoint(); dp1[DataPointValue.Value] = 2; dp1[DataPointValue.StrokeStyle] = Color.IndianRed; line.AddDataPoint(dp1);
NDataPoint dp2 = new NDataPoint(); dp2[DataPointValue.Value] = 24; dp2[DataPointValue.StrokeStyle] = Color.Green; line.AddDataPoint(dp2);
NDataPoint dp3 = new NDataPoint(); dp3[DataPointValue.StrokeStyle] = Color.HotPink; dp3[DataPointValue.Value] = 5; line.AddDataPoint(dp3);
NDataPoint dp4 = new NDataPoint(); dp4[DataPointValue.StrokeStyle] = (Color.Blue); dp4[DataPointValue.Value] = 3; line.AddDataPoint(dp4);
NDataPoint dp5 = new NDataPoint(); dp5[DataPointValue.StrokeStyle] = (Color.Brown); dp5[DataPointValue.Value] = 12; line.AddDataPoint(dp5);
NDataPoint dp6 = new NDataPoint(); dp6[DataPointValue.StrokeStyle] = (Color.Black); dp6[DataPointValue.Value] = 17; line.AddDataPoint(dp6);
NDataPoint dp7 = new NDataPoint(); dp7[DataPointValue.StrokeStyle] = (Color.Chocolate); dp7[DataPointValue.Value] = 6; line.AddDataPoint(dp7);
NDataPoint dp8 = new NDataPoint(); dp8[DataPointValue.StrokeStyle] = (Color.Cyan); dp8[DataPointValue.Value] = 18; line.AddDataPoint(dp8);
NDataPoint dp9 = new NDataPoint(); dp9[DataPointValue.StrokeStyle] = (Color.DarkRed); dp9[DataPointValue.Value] = 20; line.AddDataPoint(dp9);
NDataPoint dp10 = new NDataPoint(); dp10[DataPointValue.StrokeStyle] = (Color.Gray); dp10[DataPointValue.Value] = 8; line.AddDataPoint(dp10);
chart.Series.Add(line);
Regards, Sharmila
|
Group: Forum Members
Last Active: Last Week
Posts: 3,054,
Visits: 4,009
|
Hi Sharmila, The control indeed discards all per data point information in samled mode - this is becuase in this mode it is assumed that it has to process large amounts of data (hundreds of thousands or even millions of data points). You should disable the line sampling if you want to have per data item control - note that up to a few hundred points there will be no visible performance difference.
Best Regards, Nevron Support Team
|