Bar Char 2nd Scale


https://www.nevron.com/Forum/Topic14354.aspx
Print Topic | Close Window

By Mike Holmes - 2 Years Ago
Hi,

I have a chart with 2 bar series, how can I show the scale of the 2nd bar series on the right hand side of the chart


By Nevron Support - 2 Years Ago
Hi Mike,

The following code shows how to position the axis on right side:

someAxis.Anchor = new NDockAxisAnchor(AxisDockZone.FrontRight, true);

You can also check the Axes \ General \ Docking example which shows how axis docking works.

Let us know if you have any questions.
By Mike Holmes - 2 Years Ago
Thanks, have now got the 2nd scale showing, but is the same scale range the one on the left, I need it to be as per the range for bar2 which your demo shoes.


    m_BlueAxis = ((NCartesianAxisCollection)nChart.Axes).AddCustomAxis(AxisOrientation.Vertical, AxisDockZone.FrontRight);
    m_BlueAxis.Anchor = new NDockAxisAnchor(AxisDockZone.FrontRight, true);
    nBar2.DisplayOnAxis(m_BlueAxis.AxisId, true);
https://www.nevron.com/forum/uploads/images/1ee8073a-d2db-4c7a-8db0-d968.jpg
By Nevron Support - 2 Years Ago
Hi Mike,
Make sure you turn off scaling for the second bar on the primary Y-axis:

nBar2.DisplayOnAxis((int)StandardAxis.PrimaryY, false);

Let us know if you meet any problems.
By Mike Holmes - 2 Years Ago
Thanks, that has worked
By Mike Holmes - 2 Years Ago
is it possible on the left hand scale to include a pound sign as this is a value
By Nevron Support - 2 Years Ago
Hi Mike,

Yes, you can place a currency prefix by changing the value formatter associated with the Y axis:
NLinearScaleConfigurator scaleY = chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator as NLinearScaleConfigurator;
scaleY.LabelValueFormatter = new Nevron.Dom.NNumericValueFormatter("$0.00");

More information on format .net format strings can be found here:
https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-numeric-format-strings

Let us know if you have any questions.