Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MSChart Y-Axis and X-Axis Labelling

I have data plotted onto a MSChsart line graph.

On the Y axis I have values ranging form 0 300. could anyone let me know is it possible to

change my:

Y-axis LABEL values from (0 to 300) to a value of (-150 to 150).

without changing my Y-axis DATA values.

By this I mean I want the labels to show different values, but I dont want to edit my data values plotted. So for example if I have data plotted on Y-axis value of 150, the Y=axis label should be showing it at 0.

Any help would be greatly appreciated

like image 332
codeBlocks Avatar asked Mar 08 '11 11:03

codeBlocks


People also ask

How do I label the x and y-axis in Word?

Click the chart, and then click the Chart Layout tab. Under Labels, click Axis Titles, point to the axis that you want to add titles to, and then click the option that you want. Select the text in the Axis Title box, and then type an axis title.

Do you label the x or y-axis first?

The x-coordinate always comes first, followed by the y-coordinate. As you can see in the coordinate grid below, the ordered pairs (3,4) and (4,3) are two different points!

How do you label the x-axis?

Right-click the category labels to change, and click Select Data. In Horizontal (Category) Axis Labels, click Edit. In Axis label range, enter the labels you want to use, separated by commas.


1 Answers

Implemt Customize event

    private void chart1_Customize(object sender, EventArgs e)
    {
        foreach (var label in chart1.ChartAreas[0].AxisY.CustomLabels)
        {
            label.Text = (double.Parse(label.Text) - 150).ToString();
        }
    }
like image 172
Stecya Avatar answered Oct 03 '22 23:10

Stecya