Group: Forum Members
Last Active: Last Week
Posts: 3,054,
Visits: 4,009
|
Hi Marcus, Its not clear from the code below where you populate the line with data, can you post that code as well or ideally provide a sample that replicates the problem?
Best Regards, Nevron Support Team
|
Group: Forum Members
Last Active: 11 Years Ago
Posts: 2,
Visits: 1
|
I´m using Nevron chart to plot some .csv files and I need to show the data Labels of the Series. But when I use the properties "Serie.DataLabelStyle.Visible = true" it doesn´t work.
This is the code that I´m using:
To Load the config of the Chart:
private void LoadChartConfig() { nccGraficos.Legends.Clear(); _nchChart = nccGraficos.Charts[0]; _nchChart.Axis(StandardAxis.PrimaryY).View = new NRangeAxisView(new NRange1DD((double)nudPrimMinY.Value, (double)nudPrimMaxY.Value)); _nchChart.Axis(StandardAxis.SecondaryY).View = new NRangeAxisView(new NRange1DD((double)nudSecMinY.Value, (double)nudSecMaxY.Value)); _nchChart.Axis(StandardAxis.SecondaryY).Visible = false; _nchChart.LabelLayout.EnableLabelAdjustment = true; nccGraficos.Panels.Clear(); nccGraficos.Panels.Add(_nchChart); _nchChart.BoundsMode = BoundsMode.Stretch; _nchChart.Dock = DockStyle.Fill; _nchChart.Padding = new NMarginsL( new NLength(1, NRelativeUnit.ParentPercentage), new NLength(5, NRelativeUnit.ParentPercentage), new NLength(1, NRelativeUnit.ParentPercentage), new NLength(5, NRelativeUnit.ParentPercentage));
NAxis axis = _nchChart.Axis(StandardAxis.PrimaryX); NDateTimeScaleConfigurator dateTimeScale = new NDateTimeScaleConfigurator(); dateTimeScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; dateTimeScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); dateTimeScale.MajorGridStyle.SetShowAtWall(ChartWallType.Floor, false); dateTimeScale.MaxTickCount = 5; dateTimeScale.MajorTickMode = MajorTickMode.AutoMaxCount; NDateTimeUnit[] autoUnits = new NDateTimeUnit[] { NDateTimeUnit.Hour, NDateTimeUnit.Minute, NDateTimeUnit.Second, NDateTimeUnit.Millisecond }; dateTimeScale.AutoDateTimeUnits = autoUnits; dateTimeScale.RoundToTickMin = false; dateTimeScale.RoundToTickMax = false; dateTimeScale.EnableUnitSensitiveFormatting = false; dateTimeScale.LabelValueFormatter = new NDateTimeValueFormatter("HH:mm:ss.fff"); dateTimeScale.AutoMinorTicks = true; axis.ScaleConfigurator = dateTimeScale;
NDateTimeAxisPagingView pageview = new NDateTimeAxisPagingView(); pageview.Enabled = true; double Span = DateTime.Now.AddSeconds(10).ToOADate() - DateTime.Now.ToOADate(); pageview.MinPageLength = Span; _nchChart.Axis(StandardAxis.PrimaryX).PagingView = pageview; nccGraficos.Controller.Tools.Add(new NAxisScrollTool());
NCartesianChart chart1 = (NCartesianChart)nccGraficos.Charts[0]; chart1.Axis(StandardAxis.PrimaryX).ScrollBar.Visible = true; chart1.Axis(StandardAxis.PrimaryX).ScrollBar.ResetButton.Visible = false;
nccGraficos.Controller.Selection.Add(chart1); nccGraficos.Settings.RenderSurface = RenderSurface.Window; this.lblNomeTela.Text = "Gráfico de Visualização de Canais"; }
To Add Series to the Chart: public void AddChanneltoDVG(NLineSeries Serie, Color NewColor, int SelectValue, string ChannelName) { DataGridViewRow dr = new DataGridViewRow(); dr.CreateCells(_grdCanais); dr.Cells[0].Value = ChannelName; dr.Cells[2].Value = SelectValue; dr.Cells[1].Style.BackColor = NewColor; dr.Cells[3].Value = Serie.Name; _grdCanais.Rows.Add(dr);
DataGridViewRow dr2 = new DataGridViewRow(); dr2.CreateCells(_grdEstatistica); dr2.Cells[0].Value = ChannelName; dr2.Cells[4].Value = Serie.Name; _grdEstatistica.Rows.Add(dr2);
_nchChart.Series.Add(Serie); Serie.SamplingMode = SeriesSamplingMode.Enabled; Serie.BorderStyle.Color = NewColor; Serie.InflateMargins = true; Serie.UseXValues = true; Serie.MultiLineMode = MultiLineMode.Series; Serie.SamplingMode = SeriesSamplingMode.Enabled; Serie.BorderStyle.Width = new NLength(1.5f);
switch (SelectValue) { case 0: Serie.DisplayOnAxis((int)StandardAxis.PrimaryY, true); Serie.DisplayOnAxis((int)StandardAxis.SecondaryY, false); break; case 1: Serie.DisplayOnAxis((int)StandardAxis.SecondaryY, true); Serie.DisplayOnAxis((int)StandardAxis.PrimaryY, false); break; default: NAxis customAxis = CreateCustomAxis(_nchChart, NewColor); Serie.DisplayOnAxis((int)StandardAxis.PrimaryY, false); Serie.DisplayOnAxis((int)StandardAxis.SecondaryY, false); Serie.DisplayOnAxis(customAxis.AxisId, true); break; } _bolDropFlag = true; _grdCanais.RefreshEdit();
}
And to enable the Labels:
private void checkBox1_CheckedChanged(object sender, EventArgs e) { foreach (NLineSeries Serie in _nchChart.Series) { Serie.DataLabelStyle.Visible = true; Serie.DataLabelStyle.Format = " < value >"; Serie.DataLabelStyle.ArrowLength = new NLength(0); Serie.DataLabelStyle.ArrowStrokeStyle.Width = new NLength(0, NGraphicsUnit.Pixel); Serie.DataLabelStyle.TextStyle.BackplaneStyle.Shape = BackplaneShape.Ellipse; Serie.DataLabelStyle.TextStyle.BackplaneStyle.FillStyle = new NColorFillStyle(Color.OldLace); Serie.DataLabelStyle.TextStyle.BackplaneStyle.StandardFrameStyle.InnerBorderColor = Color.DarkOrange;
} nccGraficos.Refresh(); }
Any ideas why doens´t work?
|