Small values are not visible in BarSeries

4 posts, 0 answers
  1. Mostafa
    Mostafa avatar
    3 posts
    Member since:
    Jun 2013

    Posted 14 Sep 2015 Link to this post

    Hello,

    I'm using RadCartesianChart  and stacked BarSeries, it works fine but when adding small values, the bar is not shown,

     

    sample of values; 80, 50, and 0.39

    I can't see any bar for value 0.39

     

    I tried to add MinHeight but didn't work

     

    <telerikChart:RadCartesianChart  x:Name="StackedChart" EmptyContent="" Margin="-10,0,0,0" HorizontalAlignment="Center" Width="110">
                                <telerikChart:RadCartesianChart.Grid>
                                    <telerikChart:CartesianChartGrid MajorLinesVisibility="None" StripLinesVisibility="None"/>
                                </telerikChart:RadCartesianChart.Grid>
                                <telerikChart:RadCartesianChart.HorizontalAxis>
                                    <telerikChart:CategoricalAxis x:Name="XAxis" Margin="5,0,0,0"  BorderThickness="0" GapLength="0.4" Foreground="Black" />
                                </telerikChart:RadCartesianChart.HorizontalAxis>
                                <telerikChart:RadCartesianChart.VerticalAxis>
                                    <telerikChart:LinearAxis x:Name="YAxis" Visibility="Collapsed" Minimum="0"  />
                                </telerikChart:RadCartesianChart.VerticalAxis>
                                <telerikChart:RadCartesianChart.Behaviors >
                                    <telerikChart:ChartSelectionBehavior  DataPointSelectionMode="Single" SelectionChanged="ChartSelectionBehavior_SelectionChanged" />
                                </telerikChart:RadCartesianChart.Behaviors>
                                <telerikChart:BarSeries x:Name="AA"  CombineMode="Stack"  >
                                    <telerikChart:BarSeries.PointTemplates>
                                        <DataTemplate>
                                            <Border  Background="#00b0c9"  BorderThickness="2"/>
                                        </DataTemplate>
                                    </telerikChart:BarSeries.PointTemplates>
                                    <telerikChart:BarSeries.ValueBinding >
                                        <telerikChart:PropertyNameDataPointBinding PropertyName="value" />
                                    </telerikChart:BarSeries.ValueBinding>
                                    <telerikChart:BarSeries.CategoryBinding>
                                        <telerikChart:PropertyNameDataPointBinding PropertyName="category"/>
                                    </telerikChart:BarSeries.CategoryBinding>
                                </telerikChart:BarSeries>
     
                                <telerikChart:BarSeries x:Name="BB"  CombineMode="Stack" >
                                    <telerikChart:BarSeries.PointTemplates>
                                        <DataTemplate>
                                            <Border MinHeight="20"  Background="#097373"  BorderThickness="2"/>
                                        </DataTemplate>
                                    </telerikChart:BarSeries.PointTemplates>
                                    <telerikChart:BarSeries.ValueBinding >
                                        <telerikChart:PropertyNameDataPointBinding PropertyName="Data" />
                                    </telerikChart:BarSeries.ValueBinding>
                                    <telerikChart:BarSeries.CategoryBinding>
                                        <telerikChart:PropertyNameDataPointBinding PropertyName="CustomedDate" />
                                    </telerikChart:BarSeries.CategoryBinding>
     
                                    <telerikChart:BarSeries.DefaultVisualStyle>
                                        <Style TargetType="Border">
                                            <Setter Property="MinHeight" Value="20"/>
                                        </Style>
                                    </telerikChart:BarSeries.DefaultVisualStyle>
                                </telerikChart:BarSeries>
     
                            </telerikChart:RadCartesianChart>

     

     

  2. Ves
    Admin
    Ves avatar
    2879 posts

    Posted 17 Sep 2015 Link to this post

    Hi Mostafa,

    Indeed, when there are some big values and some small values, it is possible that the small values are so small, that they do not count for a single pixel. In this specific case, if anything is shown, it stays within the border's width of two pixels. Applying minimum height would be incorrect, as it would lead to the chart showing false data e.g. 20 pixels might correspond to a value of 10 or even more.

    I have attached a small example, which displays the values you mentioned -- 80, 50 and 0.39. It shows a tiny bar for the 0.39 and while it would not be possible to define the exact value by just looking at the bar, it still shows there is an item with a very small value there. This is easily explained by the difference in values magnitude. I hope this helps.

    Best regards,
    Ves
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. DevCraft banner
  4. Mostafa
    Mostafa avatar
    3 posts
    Member since:
    Jun 2013

    Posted 04 Oct 2015 in reply to Ves Link to this post

    What if data is 10000, 500, and 0.39

    The value 0.39 is not visible.

    it's just like no data 

  5. Ves
    Admin
    Ves avatar
    2879 posts

    Posted 07 Oct 2015 Link to this post

    Hi Mostafa,

    As I mentioned, if the value is too small, the bar height might just not be enough. Let's consider an example -- if a bar with a value of 10000 is displayed with 500 px height, then a value of 20 would be displayed as 1 px high bar, but a value of 0.39 would be just a small fraction of a pixel, hence it would be expected that it was not displayed. In this case, I would suggest setting ShowLabels property of the chart series to true, so that it's clear that there is certain value.

    Best regards,
    Ves
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top