Profile Picture

Calculate/convert axis labels

Posted By Yonatan Doron 8 Years Ago
Author
Message
Yonatan Doron
Question Posted 8 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)

Group: Forum Members
Last Active: 8 Years Ago
Posts: 2, Visits: 20
Hi,

I'm using a NTriangulatedSurfaceSeries, and I would like to change the values displayed near the axis ticks.
For example, instead of the X axis ticks display values of -10000,0,10000, I would like to display -5,0,5.
Is there a way to supply something like a conversion function to convert the original value to the value I want to display?

What is the best way to accomplish this without changing the data supplied to the chart?

Nevron Support
Posted 8 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Yesterday @ 1:54 AM
Posts: 3,054, Visits: 4,009
Hi Yonatan,

The following code shows how to apply a value scale to axis labels:

 NLinearScaleConfigurator linearScale = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator;    
linearScale.LabelStyle.ValueScale = 0.0001;

Using this code labels that would normally show as 1000, 2000, will display as 1,2 etc.

Alternatively you can create a custom label value formatter:

        class CustomValueFormatter : NValueFormatter
        {
            public override string FormatValue(double value)
            {
                return (value / 1000).ToString();
            }

            public override string FormatValue(object value)
            {
                return FormatValue((double)value);
            }
        }

// somewhere in code
            NChart chart = nChartControl1.Charts[0];

            NLinearScaleConfigurator linearScale = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator;
            linearScale.LabelValueFormatter = new CustomValueFormatter();

Let us know if you meet any problems.


Best Regards,
Nevron Support Team





Similar Topics


Reading This Topic