How to display the range of Polar Chart axes in decimal places.

A forum dedicated to WPF version of LightningChart Ultimate.

Moderator: Arction_LasseP

jeonhui
Posts: 4
Joined: Mon Sep 16, 2019 4:02 am

How to display the range of Polar Chart axes in decimal places.

Post by jeonhui » Tue Jun 16, 2020 2:26 am

Hello?
First, I am sorry for my poor English.
I am developing a Polar Chart using ViewPolar.
However, there was a problem.

I would like to set the range of the amplitude axis to a decimal point.
For example, I want to set m_chart.SetRange(10.5 , 50.5).
However, after setting it up, the axis values displayed in the chart are min 11, max 51.

Also, m_chart.MinAmplitude = 10.5 / m_chart.MaxAmplitude = 50.5
It's the same result if you use it in the same way as .

I wonder if there's a setup I missed.

Thank you for reading it.

Arction_LasseP
Posts: 105
Joined: Wed Mar 27, 2019 1:05 pm

Re: How to display the range of Polar Chart axes in decimal places.

Post by Arction_LasseP » Tue Jun 16, 2020 6:59 am

Hello,

This happens because by default, the amplitude value labels are rounded to nearest integers. However, this is true only for the label strings, the minimum and maximum values of an axis should be correct even if the labels show rounded values. This rounding happens automatically unless a small axis range is used, in which case the decimals are also shown.

The best way to fix this is to use SupplyCustomAmplitudeString -event for the axis. It allows you to manually format all the amplitude value labels, for example define the number of decimals or add units at the end of the strings. To use the event AutoFormatLabels should be set false.

Code: Select all

_chart.ViewPolar.Axes[0].AutoFormatLabels = false;
_chart.ViewPolar.Axes[0].SupplyCustomAmplitudeString += Axis_SupplyCustomAmplitudeString;

private void Axis_SupplyCustomAmplitudeString(object sender, SupplyCustomAmplitudeStringEventArgs e)
{
    e.ValueAsString = e.Value.ToString("0.0"); // Show one decimal in every label.
}
Hope this helps.
Best regards,
Lasse