multiple y-axis in chart

mattijsstu

Member
Joined
Feb 19, 2013
Messages
15
Programming Experience
Beginner
hi

I would like to make a graph in vs 2012. The graph looks like this sketch below. It has 3 curves and those 3 curves all have to get a individual y-axis. I can't seem to find out how i can do this.
grafiek help.jpg

I already got all my points to plot and i use this code:

VB.NET:
[/FONT]



Chart1.Series.Clear()
        Chart1.Titles.Add("Q-h kromme")
        Dim q As New Series
        q.Name = "Debiet m³/s"
        q.ChartType = SeriesChartType.Spline
        q.Points.AddXY(hv100, q100)
        q.Points.AddXY(hv90, q80)
        q.Points.AddXY(hv79, q60)
        q.Points.AddXY(hv65, q40)
        q.Points.AddXY(hv45, q20)
        q.Points.AddXY(hv10, q0)
        Chart1.Series.Add(q)




        Dim n As New Series
        n.Name = "nhyd"
        n.ChartType = SeriesChartType.Spline
        n.Points.AddXY(hv100, nhyd)
        n.Points.AddXY(hv90, nhyd - 0.5)
        n.Points.AddXY(hv79, nhyd - 2)
        n.Points.AddXY(hv65, nhyd - 5)
        n.Points.AddXY(hv45, nhyd - 10)
        n.Points.AddXY(hv10, 0)
        Chart1.Series.Add(n)


        Dim p As New Series
        p.Name = "Pafg"
        p.ChartType = SeriesChartType.Spline
        p.Points.AddXY(hv100, P100)
        p.Points.AddXY(hv90, P90)
        p.Points.AddXY(hv79, P79)
        p.Points.AddXY(hv65, P65)
        p.Points.AddXY(hv45, P45)
        p.Points.AddXY(hv10, P10)
        Chart1.Series.Add(p)
    End Sub[FONT=Verdana]
 
The Chart control has a ChartArea object, which has an Axes collection, this collection has one primary and one secondary x/y axis. In Series configuration you can set X/YAxisType to be primary or secondary. So one ChartArea can only support two y axes. Click into the ChartAreas and Series dialogs in designer and you'll see what I mean.
 
Back
Top