Bagzli
Bagzli

Reputation: 6579

ASP.NET Chart Manipulation with c#

To explain my question I drew an image, here it is:

enter image description here

So I have a Chart that has a bar graph and a line chart, 2 in 1. I am trying to displaly it in asp.net just the way i drew it on here. This means the A box on the image has a set of values which reflect the line graph, and C box on the image has a set of values that define the bar graph values.

What I want to ask is how do I set two different sets of values on a single chart. I know I can use series to draw multiple graphs and by having series defined as different types I can change if its a bar graph or a ilne chart, however I don't know how to add 2 range of values on the side.

As for the the box B, what I wish to ask is how do I set these values so that they are showing different dates, I was able to do it using a line of code shown bellow, however that line of code sets every value to same, and I need them to reflect different values such as range of dates in this example on the image.

Code that I tried is: Chart1.Series["Series1"].AxisLabel = "Test";

Help is most appreciated!

Cheers!

Upvotes: 0

Views: 582

Answers (1)

Bagzli
Bagzli

Reputation: 6579

Ok so i'm going to leave this question up for those that come into similar problem.

This is how you set column A and column c

Chart1.Series[0].YAxisType = AxisType.Primary;
    Chart1.Series[1].YAxisType = AxisType.Secondary;

    Chart1.ChartAreas[0].AxisY.Maximum = 500;
    Chart1.ChartAreas[0].AxisY2.Maximum = 7000;

Your grid lines might get messed up so if you want to disable them use

Chart1.ChartAreas[0].AxisY2.MajorGrid.Enabled = false;

And just as a bonus if you want to set intervals on each Y axis you can do that with

Chart1.ChartAreas[0].AxisY.Interval = 50;

I still haven't figured out how to do part B that I mentioned, so if you know the answer then please share.

Cheers!

Upvotes: 0

Related Questions