0

I'm new in C# development and have some problem that hope I can find the answer here for. My chart has data source from Excel and chart with default values shows correctly, however I would like to have Axis-X label to be scale (from 1 to 100 or more) instead of column value. This is how sample data looks like:

enter image description here

So in my chart, Axis X has labels like: "test1 test2 test3 test4 test5 test6 test7"

But I would like to have scale which present number of instances from lowest to highest number, like:

1 2 3 4 5 6 7

I hope somebody can help with an example or direction of what I should set in the Axis-X properties to achieve this goal.

Thanks,

Rado

2
  • Welcome. Please post the code you have tried, and tell us the resulting error Commented Nov 21, 2015 at 4:09
  • You ca set the yourChartArea.XAxis.Minimum and .Maximum values. Commented Nov 21, 2015 at 7:48

1 Answer 1

0

Just add your datapoints to Series with:

chart1.Series[0].Points.AddY(yourYValue);

or

chart1.Series[0].Points.DataBindY(yourListOfYValues);

instead of(i assume your using one of these, some code would be helpful):

chart1.Series[0].Points.AddXY(yourXValue,yourYValue);

or

chart1.Series[0].Points.DataBindXY(yourXValue, yourListOfYValues);

The chart control should then set your x-axis-label to 1,2,3... by default. I hope this helps.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.