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

Display 1 values with logarithmic scale

4 Answers 166 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Massimo
Top achievements
Rank 1
Massimo asked on 10 Aug 2017, 10:58 AM

Hi, I'm struggling with a small display issue:

I have a bar chart with logarithmic Y scale. Evetyng is ok but if a bar has the value of 1 is not displayed. And this is correct because the logarithm of 1 is 0.
So there is no difference between a bar is not present and a bar with value 1.

I tried to set the minimum value of 0.5 but it's only displayed a gap between the X axis and the bars.

Is there a way to display small Bar when the values is 1? Like setting a small border or a padding?

4 Answers, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 15 Aug 2017, 06:57 AM
Hello Massimo,

To achieve your requirement you can set a MinHeight for the Border elements representing the data points. You can do that via the DefaultVisualStyle property of the series.
<telerik:BarSeries.DefaultVisualStyle>
    <Style TargetType="Border">
        <Setter Property="MinHeight" Value="1" />
        <Setter Property="Background" Value="Green" />
    </Style>
</telerik:BarSeries.DefaultVisualStyle>

Or you can set the OriginValue property of the bar series. The property determines the start value from where to bar will start drawing.

Regards,
Martin Ivanov
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
Massimo
Top achievements
Rank 1
answered on 18 Aug 2017, 04:12 PM

Thanks for your help, but I'm not able to make it works.

The min height works, but the bar is below the axis and it's not visible.

Eventhe border is always transparent.. I think is an issue with VisualStudio2013 style

0
Martin Ivanov
Telerik team
answered on 23 Aug 2017, 10:53 AM
Hello Massimo,

The chart doesn't depend much on the applied theme and the described behavior probably is not because of the theme. The bar is positioned under the axis because it is drawn starting from its value to the origin value which in this case should be 1. When you set the MinHeight, the bar will be draw from its value (in your case 1) to the MinHeight value in down direction. The bar is not displayed because it is clipped to the plot area (the area between the axes).

In order to resolve this you could set the Minimum of the axis to a lower value. However, in your scenario you can't do this because the axis is logarithmic. In this case I could suggest you to apply a small margin in the default visual style for the bars with value 1. You can do that via the DefaultVisualStyleSelector property of the series. Or using an IValueConverter. You can see this approach demonstrated in the attached project. I hope it helps.

Regards,
Martin Ivanov
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
Massimo
Top achievements
Rank 1
answered on 23 Aug 2017, 12:52 PM
thanks, it works perfectly!
Tags
ChartView
Asked by
Massimo
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Massimo
Top achievements
Rank 1
Share this question
or