Logarithmic ChartArea: Cannot extend bars to fill unneeded space.

2 posts, 0 answers
  1. Grant
    Grant avatar
    2 posts
    Member since:
    Mar 2012

    Posted 03 Apr 2012 Link to this post

    Hi all,

    I'm having an issue with the UI of a project I'm working on.  I've set up a logarithmic chart that includes multiple series; two are bars and the other a line.

    The issue is that I'm not able to fill in the extra extended space on the top of the chart with the bars I'm presenting.  I've read forum after forum but nothing seems to work.  I've tried setting AutoRange to false and manually setting MaxValue, MinValue, and Step, but that didn't work either.  Below are my current VB.NET settings:
    With Me.myChart.DefaultView
    .ChartArea.AxisY.IsLogarithmic = True
    .ChartArea.AxisY.AutoRange = True
    .ChartArea.AxisY.ExtendDirection = AxisExtendDirection.None
    .ChartArea.AxisY.IsZeroBased = True
    End With

    I've even gone as far as calculating the correct LogarithmicBase that would allow me to have a particular maximum value.  Obviously, the issue with this is that it changes the scale of each step in an unintuitive format, so the user is confused about the scale ontop of having to understand logarithms ;)

    If possible, I'd be happy to simply cut off the last step of the chart, which would take my chart from five to four steps.  I'm also curious whether I have to apply these settings to both bar series, or simply edit the DefaultView.  Any thoughts?
  2. Petar Marchev
    Petar Marchev avatar
    968 posts

    Posted 06 Apr 2012 Link to this post

    Hi Grant,

    If I understand you correctly you are talking about the space that is above the tallest bar. (attachment EmptySpace.png)

    And you would like to not have that empty space. (NoEmptySpace.png)

    If NoEmptySpace.png is the desired effect - you need to set the MaxValue of the logarithmic Y axis appropriately. Below I have pasted some code to point you in the right direction:
    Dim data(3) As Integer
    data(0) = 5
    data(1) = 150
    data(2) = 500
    data(3) = 800
    Me.radChart1.DefaultView.ChartArea.AxisY.IsLogarithmic = True
    Me.radChart1.DefaultView.ChartArea.AxisY.AutoRange = False
    Me.radChart1.DefaultView.ChartArea.AxisY.MaxValue = Math.Log(data.Max(), 10)
    Me.radChart1.ItemsSource = data

    Let us know if this helps and or you need further assistance.

    Petar Marchev
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
  3. DevCraft banner
Back to Top