Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
300
FinancialPriceSeries Half Bar on margin
posted

When plotting a financial bar series, the rightmost and leftmost bars (on the margins) are cut in half. We have found no way to adjust the display to show these bars in full.

Here's an example:

 

Why is the width of the rightmost green bar cut in half? Is there a way to prevent this from happening?

Regards,

Jim

Parents Reply
  • 30692
    Offline posted in reply to Jim

    Jim,

    When I referred to this as an "issue" I was indicating its status as a known bug with the control. I'm sorry if I was unclear. However, this bug exists because of a missing feature in the chart (namely the ability to establish axis margins, or have them automatically established for you).

    This feature is already on the backlog. I'm hoping we will address this in this coming release, but it really depends on how the backlog is prioritized. Submitting a feature request may assist in the backlog item being assigned with the correct priority, and it may not hurt to raise the issue with productmanager@infragistics.com also.

    You can approximate this missing feature by putting some margins on the series and the axes, like below. But you will notice some visual aspects of the series and some features not working appropriately due to the fact that the series and axes are determining visibility information based on their bounds. This is why the concept of content margins needs to be introduced as a feature to the chart rather than approximated using its sub components:

     

    <Grid x:Name="LayoutRoot" Background="White">
                <igChart:XamDataChart x:Name="theChart" 
                                      PlotAreaBackground="White"
                                      HorizontalZoomable="True"
                                      VerticalZoomable="True">
                    <igChart:XamDataChart.Axes>
                        <igChart:NumericYAxis x:Name="yAxis" Margin="50,0,50,0" />
                    <igChart:CategoryXAxis Margin="50,0,50,0"
                        x:Name="xAxis"
                        ItemsSource="{StaticResource data}"
                        Label="{}{Label}">
                        <igChart:CategoryXAxis.LabelPanelStyle>
                            <Style TargetType="Panel">
                                <Setter Property="Margin" Value="50,0,50,0" />
                            </Style>
                        </igChart:CategoryXAxis.LabelPanelStyle>
                    </igChart:CategoryXAxis>
                </igChart:XamDataChart.Axes>
                    <igChart:XamDataChart.Series>
                    <igChart:FinancialPriceSeries
                        x:Name="series"
                            Margin="50,0,50,0"
                        ItemsSource="{StaticResource data}"
                        XAxis="{Binding ElementName=xAxis}"
                        YAxis="{Binding ElementName=yAxis}"
                            DisplayType="Candlestick"
                        OpenMemberPath="Open"
                            HighMemberPath="High"
                            CloseMemberPath="Close"
                            LowMemberPath="Low"
                            >
                        <igChart:FinancialPriceSeries.ToolTip>
                            <TextBlock Text="{Binding Item.Label}" />
                        </igChart:FinancialPriceSeries.ToolTip>
                    </igChart:FinancialPriceSeries>
                </igChart:XamDataChart.Series>
                </igChart:XamDataChart>
            </Grid>
    

     Here is what the result looks like:

     

    Notice how the axis lines don't extend into the marginal regions? This could be argued to be ok at this zoomed out level, but notice what happens if you zoom in:

     

    Here it just isn't acceptable that the axis is using its bounds to define how far its content extends, and the only reason we are seeing the candlesticks that are out of the view is that the series will often render a shape that might be partially clipped by its bounds.

    A safer way to approximate axis margins might be to insert a double.NaN value at the beginning and end of the series. That looks like this:

     

    However, when using that strategy, and using trendlines or indicators, you may cause moving calculations to be invalid for longer during their first period, etc. There is a property on indicators that you can use to ignore the first so many values in the display on an indicator to avoid the invalid first period values, but I cannot recall if we provide the same functionality for trendlines at present.

    Hope this helps!

    -Graham

Children