This is a migrated thread and some comments may be shown as answers.

Logarithmic ChartArea: Cannot extend bars to fill unneeded space.

1 Answer 97 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Grant
Top achievements
Rank 1
Grant asked on 03 Apr 2012, 06:41 PM
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?

1 Answer, 1 is accepted

Sort by
0
Petar Marchev
Telerik team
answered on 06 Apr 2012, 10:42 AM
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.

Greetings,
Petar Marchev
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Tags
Chart
Asked by
Grant
Top achievements
Rank 1
Answers by
Petar Marchev
Telerik team
Share this question
or