Group: Forum Members
Last Active: 4 Years Ago
Posts: 10,
Visits: 25
|
I have a NChart with a NChartControl. I added three series to this NChart : two PointSeries, one GraphicsPathSeries. After adding some line segments to GraphicsPathSeries, I tried to add some datapoints to PointSeries. But View of legend, header and axis which has been originally viewed good just disappeared. Is it impossible to hold different type of chart series in one chart ? Here is my Code : NChart nChart = nChartControl1.Charts[0]; nChart.Axis(StandardAxis.Depth).Visible = false;
NPointSeries SeriesA = nChart.Series.Add(SeriesType.Point) as NPointSeries; SeriesA.Size = new NLength(2, NRelativeUnit.ParentPercentage); SeriesA.Name = "Series A"; SeriesA.PointShape = PointShape.Asterisk; SeriesA.UseXValues = true; SeriesA.DataLabelStyle.Visible = false; SeriesA.FillStyle = new NColorFillStyle(Color.DarkKhaki); SeriesA.InflateMargins = true;
NPointSeries SeriesB = nChart.Series.Add(SeriesType.Point) as NPointSeries; SeriesB.Size = new NLength(2, NRelativeUnit.ParentPercentage); SeriesB.Name = "Series B" SeriesB.PointShape = PointShape.Diamond; SeriesB.UseXValues = true; SeriesB.DataLabelStyle.Visible = false; SeriesB.FillStyle = new NColorFillStyle(Color.Red); SeriesB.InflageMargins = true;
NGraphicsPathSeries SeriesC = nChart.Series.Add(SeriesType.GraphicsPath) as NGraphicsPathSeries; SeriesC.Name = "Series C"; SeriesC.FillStyle = new NColorFillStyle(Color.DarkGray); SeriesC.InflageMargins = true;
NAxis axisX = nChart.Axis(StandardAxis.PrimaryX); NAxis axisY = nChart.Axis(StandardAxis.PrimaryY); axisX.ScaleConfigurator.Title.Text = "X Axis"; axisY.ScaleConfigurator.Title.Text = "Y Axis"; axisX.ScaleConfigurator.Invert = true; axisX.View = new NRangeAxisView(new NRange1DD(-1000.0, 1000.0), true, true); axisY.View = new NRangeAxisView(new NRange1DD(-500, 500), true, true);
NGraphicsPath graphicsPath = new NGraphicsPath(); graphicsPath.AddLineSegment(new NPointD(2.0, 0.0), new NPointD(1.0, 1.0)); graphicsPath.AddLineSegment(new NPointD(1.0, 1.0), new NPointD(-1.5, 1.0)); graphicsPath.AddLineSegment(new NPointD(-1.5, 1.0), new NPointD(-1.5, -1.0)); graphicsPath.AddLineSegment(new NPointD(-1.5, -1.0), new NPointD(1.0, -1.0)); graphicsPath.AddLineSegment(new NPointD(1.0, -1.0), new NPointD(2.0, 0.0)); SeriesC.GraphicsPath = graphicsPath;
SeriesA.ClearDataPoints(); SeriesA.AddDataPoint(new NDataPoint(10, 10)); // This is when everything go disappear SeriesA.AddDataPoint(new NDataPoint(20, 20)); ... ...
|