Get rid of label for specific datapoint


Author
Message
Torsten Tiedt
Torsten Tiedt
Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)
Group: Forum Members
Posts: 1, Visits: 6
Hi,

in your help section "Controlling the labels visibility" you show how to hide specific labels. Unfortunately, I can't get it work. I want the first datapoint to have no label.

Here is my code (watch for 2 comments).

Thanks for your help!

=======================


var chart = new NCartesianChart();

NDateTimeScaleConfigurator dateTimeScale = new NDateTimeScaleConfigurator();
dateTimeScale.MajorTickMode = MajorTickMode.CustomStep;
dateTimeScale.CustomStep = new NDateTimeSpan(1, NDateTimeUnit.Year);
dateTimeScale.EnableUnitSensitiveFormatting = false;
dateTimeScale.LabelValueFormatter = new NDateTimeValueFormatter("yyyy");
chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = dateTimeScale;

NBarSeries bar = (NBarSeries)chart.Series.Add(SeriesType.Bar);

bar.UseXValues = true;

var dataPoint = new NDataPoint(new DateTime(1999, 1, 1).ToOADate(), 0);

bar.AddDataPoint(dataPoint); // this point shall have no label

bar.AddDataPoint(new NDataPoint(new DateTime(2000,1,1).ToOADate(), 1, "2000 / 1"));
bar.AddDataPoint(new NDataPoint(new DateTime(2001, 1, 1).ToOADate(), 2, "2011 / 2"));
bar.AddDataPoint(new NDataPoint(new DateTime(2002, 1, 1).ToOADate(), 5, "2011 / 2"));
bar.AddDataPoint(new NDataPoint(new DateTime(2003, 1, 1).ToOADate(), 4, "2011 / 2"));

NDataLabelStyle dataLabel = new NDataLabelStyle();
dataLabel.Visible = true;
dataLabel.Format = "";

bar.DataLabelStyle.Visible = false;
bar.DataLabelStyles[0] = dataLabel; // trying to get rid of label for point at index 0

this.ChartControl.Charts.Clear();
this.ChartControl.Charts.Add(chart);

NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.NevronMultiColor);
styleSheet.Apply(this.ChartControl.Document);

this.ChartControl.Refresh();


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search