Profile Picture

Unable to apply MinorTickCount on X-axis

Posted By Muhammad Hammad 14 Years Ago
Author
Message
Muhammad Hammad
Posted 14 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)

Group: Forum Members
Last Active: 13 Years Ago
Posts: 3, Visits: 1

Hi, I have two questions here:

1) When I use

NStandardScaleConfigurator linearScale = (NStandardScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator;

linearScale.MinorTickCount = 5;

I can see minor ticks on chart , but when I use

 NStandardScaleConfigurator linearScale = (NStandardScaleConfigurator)chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator;

linearScale.MinorTickCount = 5;

I dont see them. Could you help me? I used NLinearScaleConfigurator but it is not working as well.

I am using horizontal bar chart here and want to show ticks.

2) How can I show my own labels on Y-axis. I mean

If I have range of 10.00-30.00, I want to show them on Y-axis as 10.00, 10.30, 11:00, 11:30, 12:00, 12:30...

I have large dynamic range so I cant add label for each value. Is there anyway to define the gap between two labels on axis.

Regards



bob milanov
Posted 14 Years Ago
View Quick Profile
Supreme Being

Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)

Group: Forum Members
Last Active: 6 Months Ago
Posts: 153, Visits: 11

Hi Muhammad,

1) By default the X axis uses ordinal scale, which by design does not display minor ticks. You have to switch the scale to linear in order to have minor ticks on the x axis:

chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = new NLinearScaleConfigurator();

2) You can disable the automatic labels and place your own using the customlabels collection - for example:

   NChart chart = nChartControl1.Charts[0];

   NBarSeries bar = new NBarSeries();
   bar.Values.Add(10);
   bar.Values.Add(20);
   bar.Values.Add(30);
   chart.Series.Add(bar);

   NLinearScaleConfigurator scaleY = chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator as NLinearScaleConfigurator;

   scaleY.AutoLabels = false;

   NCustomValueLabel customValueLabel = new NCustomValueLabel();
   customValueLabel.Value = 10;
   customValueLabel.Text = "10";
   scaleY.CustomLabels.Add(customValueLabel);

Alternatively you can switch the major tick mode to CustomStep:

   NLinearScaleConfigurator scaleY = chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator as NLinearScaleConfigurator;
   scaleY.MajorTickMode = MajorTickMode.CustomStep;
   scaleY.CustomStep = 10;

if you still want auto labels but don't want to use the step proposed by the chart. Let me know if you meet any problems.

Best regards,
Bob

 





Similar Topics


Reading This Topic