Group: Forum Members
Last Active: 8 Years Ago
Posts: 13,
Visits: 12
|
Hi,
I'm trying to make a Stacked Time value chart, but it seems that only Clustered is working. My code is this:
private void LoadData() { NCartesianChart cartesianChart = nChartControl1.Charts[0] as NCartesianChart;
NStandardScaleConfigurator scaleconfigurator = cartesianChart.Axis(StandardAxis.PrimaryY).ScaleConfigurator as NStandardScaleConfigurator; NDateTimeValueFormatter dateTimeFormater = new NDateTimeValueFormatter(DateTimeValueFormat.LongDate); dateTimeFormater.FormatSpecifier = "t"; scaleconfigurator.LabelValueFormatter = dateTimeFormater;
NBarSeries barSerie1 = cartesianChart.Series.Add(SeriesType.Bar) as NBarSeries; barSerie1.MultiBarMode = MultiBarMode.StackedPercent; barSerie1.DataLabelStyle.VertAlign = VertAlign.Center;
NBarSeries barSerie2 = cartesianChart.Series.Add(SeriesType.Bar) as NBarSeries; barSerie2.MultiBarMode = MultiBarMode.StackedPercent; barSerie2.FillStyle = new NColorFillStyle(Color.Red); barSerie2.DataLabelStyle.VertAlign = VertAlign.Center;
NBarSeries barSerie3 = cartesianChart.Series.Add(SeriesType.Bar) as NBarSeries; barSerie3.MultiBarMode = MultiBarMode.StackedPercent; barSerie3.FillStyle = new NColorFillStyle(Color.Green); barSerie3.DataLabelStyle.VertAlign = VertAlign.Center;
DateTime tini = DateTime.Now; DateTime tfin = DateTime.Now.AddHours(2);
NRange1DD nRange1dd = new NRange1DD(tini.ToOADate(), tfin.ToOADate());
TimeSpan span = new TimeSpan(0, 30, 0); if (span.Ticks > 0) { while (tini < tfin) { barSerie3.Values.Add(tini + span); barSerie2.Values.Add(tini - span); barSerie1.Values.Add(tini); tini += span; } } NRangeAxisView nRangeAxisView = new NRangeAxisView(); nRangeAxisView.Range = nRange1dd; cartesianChart.Axis(StandardAxis.PrimaryY).View = nRangeAxisView; NScale bu = cartesianChart.Axis(StandardAxis.PrimaryY).Scale;
nChartControl1.Refresh(); }
Can anyone help?
|