Additional Y Axis plotting incorrectly

2 posts, 0 answers
  1. Brian
    Brian avatar
    21 posts
    Member since:
    Jul 2013

    Posted 29 Nov 2014 Link to this post

    I'm trying to plot a 2nd Y axis with the associated scale on the right of the graph.  When I plot the 2nd value though, it seems to be using the scale on the left.  What am I doing wrong here?  You can see from the attached graph snapshot that the plotting isn't what I'd expect.

    Dim lineMonthlyProfits As New LineSeries
    Dim lineTotalProfits As New LineSeries
    Dim yAxisTotalProfits As New AxisY
    Do While ChartingMonth < Now()
        GrossProfit = 0 : Fees = 0
       'Code here that pulls values from db
        TotalProfit += GrossProfit - Fees
        lineMonthlyProfits.SeriesItems.Add(CInt(GrossProfit - Fees))
        chartMonthlyProfits.PlotArea.XAxis.Items.Add(CStr(Month(ChartingMonth)) & "/" & Right(CStr(Year(ChartingMonth)), 2))
        ChartingMonth = DateAdd(DateInterval.Month, 1, ChartingMonth)
    lineMonthlyProfits.Name = "Monthly Profit"
    lineMonthlyProfits.LabelsAppearance.DataFormatString = "{0:c0}"
    lineTotalProfits.LabelsAppearance.DataFormatString = "{0:c0}"
    chartMonthlyProfits.PlotArea.YAxis.MaxValue = 20000 'Not needed but in place for testing purposes
    yAxisTotalProfits.Name = "Total Profits"
    lineTotalProfits.Name = yAxisTotalProfits.Name
    chartMonthlyProfits.PlotArea.YAxis.LabelsAppearance.DataFormatString = "{0:c0}"
    chartMonthlyProfits.PlotArea.YAxis.MinorGridLines.Visible = False
    chartMonthlyProfits.PlotArea.XAxis.MinorGridLines.Visible = False
    chartMonthlyProfits.PlotArea.XAxis.MajorGridLines.Visible = False
    chartMonthlyProfits.Legend.Appearance.Visible = False
  2. Brian
    Brian avatar
    21 posts
    Member since:
    Jul 2013

    Posted 29 Nov 2014 in reply to Brian Link to this post

    I figured it out.  lineTotalProfits shoud use AxisName, not Name.
Back to Top