Profile Picture

Overlap a axis's label

Posted By inhyuk son 14 Years Ago
Author
Message
inhyuk son
Posted 14 Years Ago
View Quick Profile
Junior Member

Junior Member (21 reputation)Junior Member (21 reputation)Junior Member (21 reputation)Junior Member (21 reputation)Junior Member (21 reputation)Junior Member (21 reputation)Junior Member (21 reputation)Junior Member (21 reputation)Junior Member (21 reputation)

Group: Forum Members
Last Active: 12 Years Ago
Posts: 21, Visits: 1
Hi~
I try to avoid to overlap a axis's label using LabelFitMode.RemoveOverlap.
But it is delayed applying.

My code and a screenshot is here.
Thanks for your help.



private void RemoveOverlapLabel()
{
NChart m_Chart = nChartControl1.Charts[0];
m_Chart.BoundsMode = BoundsMode.Stretch;

NStandardScaleConfigurator scaleConfiguratorX = (NStandardScaleConfigurator)m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator;
//scaleConfiguratorX.MajorTickMode = MajorTickMode.CustomStep;

scaleConfiguratorX.LabelFitModes = new LabelFitMode[] { LabelFitMode.RemoveOverlap };

scaleConfiguratorX.AutoLabels = false;
scaleConfiguratorX.Labels.Add("France");
scaleConfiguratorX.Labels.Add("Italy");
scaleConfiguratorX.Labels.Add("Germany");
scaleConfiguratorX.Labels.Add("Norway");
scaleConfiguratorX.Labels.Add("Spain");
scaleConfiguratorX.Labels.Add("Belgium");
scaleConfiguratorX.Labels.Add("Greece");
scaleConfiguratorX.Labels.Add("Austria");
scaleConfiguratorX.Labels.Add("Sweden");
scaleConfiguratorX.Labels.Add("Finland");
scaleConfiguratorX.Labels.Add("Poland");
scaleConfiguratorX.Labels.Add("Denmark");

NBarSeries series1 = (NBarSeries)m_Chart.Series.Add(SeriesType.Bar);
series1.FillStyle = new NColorFillStyle(Color.Crimson);
series1.Name = "Product A";
series1.DataLabelStyle.Visible = false;
GenerateData(series1.Values, 12);

}

private void GenerateData(NDataSeries dataSeries, int count)
{
Random random = new Random();
for (int i = 0; i < count; i++)
{
dataSeries.Add(random.NextDouble() * 99 + 1);
}
}

Attachments
screenshot.PNG (48 views, 5.00 KB)



Similar Topics


Reading This Topic