Group: Forum Members
Last Active: 12 Years Ago
Posts: 5,
Visits: 1
|
I have a bar chart with dates displayed on the x-axis. I have used custom ticks as I need 12 months labelled and have used InflateBegin/EndContentRangewithCustomTicks to display them all, even if not all the data points are there. The data points are directly on the custom ticks as they need displaying by exact month. Therefore we have December 11, January 12 etc.. The first data point is on the origin and therefore overlaps the y axis which doesn't look very good. I need to shift the x axis away from the origin in some way. The closest I have got is to add a custom tick before the first point i.e. November 11 but if I do it this way I would like to hide the label. Thanks for your help Lucy
|
Group: Forum Members
Last Active: Last Week
Posts: 3,054,
Visits: 4,009
|
Hi Lucy, Can you post the code you're using to achieve this? Are you using a categorical or date / time scale? One way to workaround that is to have a custom label formatter that simply does not generate a label for the first tick, however we need to review the code and scale type to check what is the best approach to workaround this...
Best Regards, Nevron Support Team
|
Group: Forum Members
Last Active: 12 Years Ago
Posts: 5,
Visits: 1
|
Hi, Basic code below: NCartesianChart barChart = new NCartesianChart();_chartControl.Charts.Add(barChart); // create a date time scale NDateTimeScaleConfigurator dateTimeScale = new NDateTimeScaleConfigurator();dateTimeScale.LabelStyle.Angle = new NScaleLabelAngle(ScaleLabelAngleMode.Scale, 90);dateTimeScale.MajorTickMode = MajorTickMode.CustomTicks;DateTime [] ticks = new DateTime[12];ticks[0] = new DateTime(2011,12,1);for (int i = 1; i < 12; i++){ ticks[i] = ticks[i - 1].AddMonths(1); } dateTimeScale.CustomMajorTicks = new Nevron.Collections.NDateTimeList(ticks);dateTimeScale.LabelValueFormatter = new NDateTimeValueFormatter(DateTimeValueFormat.MonthNameYear2Digit);dateTimeScale.InflateBeginContentRangeWithCustomTicks = true;dateTimeScale.InflateEndContentRangeWithCustomTicks = true;barChart.Axis( StandardAxis.PrimaryX).ScaleConfigurator = dateTimeScale;// setup a bar series NBarSeries barSeries1 = (NBarSeries)barChart.Series.Add(SeriesType.Bar);barSeries1.MultiBarMode = MultiBarMode.Series;barSeries1.UseXValues = true;barSeries1.Values.Add(200); barSeries1.XValues.Add( new DateTime(2011, 12, 1));barSeries1.Values.Add(200); barSeries1.XValues.Add( new DateTime(2012, 1, 1));barSeries1.Values.Add(300); barSeries1.XValues.Add( new DateTime(2012, 5, 1));
Thanks for your help. Lucy
|