Custom Non-Linear Axis RRS feed

  • Question

  • I am new to VB.net programming and even newer to the charting control in particular.  We are trying to determine if the Charting controls are something we could make use of in our application, and I suspect for most of our charting needs the charting control has more features than we need, its just a matter of learning the appropriate syntax. We have one chart with a non-linear y-axis against a logarithmic x-axis.  My question is whether it is possible to create a non-linear y-axis, and the best method to use?

    The way we do it in our current charting package lets is to have the y-axis 'display values' range from 1-99.99 (which correspond to actual plotting values of 0-~6.1), however, the actual values and display values are not linearly related.  so while a display value of 1 (=real value of 0), a display value of 10 (real value ~1.045), and a display value of 20 (real value 1.485) ... in any event, we were able to apply a custom label - to the y-axis so that the display appears correct.  However, its the grid lines that are the problem.  I don't know how to set gridlines at the same location as the custom text since there aren't specific major or minor intervals.  Any suggestions?  The way we do it currently is to draw a line at each of the corresponding actaul y-values.  The custom label text is below ... I don't see how to attach a screen shot, but could show you what I want it to look like, and how it looks currently.  

    I did see a note on horizontallineannotation, but am not sure how to make this work, if it is indeed the appropriate method.  And I did also consider setting up individual series for each of the lines I want to draw, but until all of the data is processed, I don't always know the maximum of the x-axis.

    Any suggestions are appreciated.

    'Set NonLinear Y Axis - LN
            Chart1.ChartAreas("ChartArea1").AxisY.CustomLabels.Add(0, 0.681, "1")
            Chart1.ChartAreas("ChartArea1").AxisY.CustomLabels.Add(0.681, 1.045, "5")
            Chart1.ChartAreas("ChartArea1").AxisY.CustomLabels.Add(1.045, 1.485, "10")
            Chart1.ChartAreas("ChartArea1").AxisY.CustomLabels.Add(1.485, 1.802, "20")
            Chart1.ChartAreas("ChartArea1").AxisY.CustomLabels.Add(1.802, 2.073, "30")
            Chart1.ChartAreas("ChartArea1").AxisY.CustomLabels.Add(2.073, 2.326, "40")
            Chart1.ChartAreas("ChartArea1").AxisY.CustomLabels.Add(2.326, 2.58, "50")
            Chart1.ChartAreas("ChartArea1").AxisY.CustomLabels.Add(2.58, 2.851, "60")
            Chart1.ChartAreas("ChartArea1").AxisY.CustomLabels.Add(2.851, 3.168, "70")
            Chart1.ChartAreas("ChartArea1").AxisY.CustomLabels.Add(3.168, 3.608, "80")
            Chart1.ChartAreas("ChartArea1").AxisY.CustomLabels.Add(3.608, 3.971, "90")
            Chart1.ChartAreas("ChartArea1").AxisY.CustomLabels.Add(3.971, 4.653, "95")
            Chart1.ChartAreas("ChartArea1").AxisY.CustomLabels.Add(4.653, 5.417, "99")
            Chart1.ChartAreas("ChartArea1").AxisY.CustomLabels.Add(5.417, 6.046, "99.9")

    • Changed type massenc Tuesday, January 26, 2010 12:43 AM Had follow-up question
    Tuesday, December 29, 2009 2:57 PM

All replies

  • Using CustomLabel.GridTicks property you can define custom grid lines or tickmarks at any position. You can set this property on the existing custom label or create a new custom label wih empty text.

    Monday, January 11, 2010 3:54 PM
  • Thanks for the help.  I am still having difficulty, I read a few of the other posts on the CustomLabels.GridMarks ... and try some different approaches but still can't seem to get it to work for me....  the custom labels appear but without the grid marks.  In the VB.net code below, OccurenceValues is an array that holds the data for the labels.  If I change .GridTicks to any of the other available options, there is no change.  If I hadd in the RowIndex, it really messes my plot up.  And the .LabelMark property doesn't seem to help either.  Any Suggestions?

    Dim instance AS CustomLabel



    intCounter = 0 To UBound(OccurrenceValues) - 1

    instance =

    New CustomLabel
    instance.GridTicks = GridTickTypes.Gridline
    instance.FromPosition = OccurrenceValues(intCounter, 1)
    instance.ToPosition = OccurrenceValues(intCounter, 1) + 0.2
    instance.Text = OccurrenceDisplay(intCounter)
    'instance.RowIndex = intCounter
    instance.LabelMark = LabelMarkStyle.None




    Monday, January 25, 2010 10:46 PM