RadCartesianChart asymmetric bars or gap for DateTimeContinuousAxis

0 Answers 111 Views
Chart
Rick
Top achievements
Rank 1
Iron
Rick asked on 27 Jul 2023, 06:27 PM

Hi,

 

  I am using the DateTimeContinuousAxis to manage a chart with a CandlestickSeries and a RangeBarSeries.  However there is a visual "bug", the candles stroke is not always centered on the candlestick, the gap is not always equal between the bars and the candle doesn't seem to be always centered over the tick.  Please see my attached image.


// horizontal axis
<tchart:RadCartesianChart.HorizontalAxis>
    <tchart:DateTimeContinuousAxis  MaximumTicks="5" PlotStretch="Uniform" 
    PlotMode="OnTicks" GapLength="0.3" FontSize="11" LastLabelVisibility="Visible"  Visibility="Visible"/>
</tchart:RadCartesianChart.HorizontalAxis>

// first serie
<tchart:CandlestickSeries x:Name="candleStickSeriesA" ItemsSource="{Binding}" ClipToPlotArea="False"  ZIndex="10"
                                                  tchart:ChartTrackBallBehavior.TrackInfoTemplate="{StaticResource EmptyTemplate}">

// second serie
<tchart:RangeBarSeries x:Name="candleVolumeSeriesA" ItemsSource="{Binding}" ZIndex="1"
                                               tchart:ChartTrackBallBehavior.TrackInfoTemplate="{StaticResource EmptyTemplate}">

 

  My guess is that this is in relation with the zoom level, probably the space cannot be divided perfectly by the candle space / gap or something like that.

  I need to use the DateTimeContinuousAxis because it's the only DateTime axis that allows for a constant max number of labels.  I really think this feature should be available on all Axis types..

Anyway to fix this?  Maybe an adaptive GapLength would be a good feature to add, unless I am missing something.

 

Thank you!

 

Martin Ivanov
Telerik team
commented on 02 Aug 2023, 12:57 PM

I've tried to recreate the issue on my side, but couldn't do that. However, the described behavior is not surprising. As you already guessed, the space cannot be divided perfectly and you got uneven positions here and there, which is why the candlestick stroke doesn't seem perfectly centered in all cases. As for the range bars, probably there is the same behavior, but it is possible that this can be fixed by compensating the gaps by moving the bars a bit. However, without recreating this I cannot confirm what exactly happens. That said, would it be possible to send over the project that recreates the issue?
Rick
Top achievements
Rank 1
Iron
commented on 02 Aug 2023, 01:17 PM

Hi Martin!  Thanks for your help.  At the moment it's too difficult for me to recreate a simple project with this data, as it involves databases, shared methods, other nugget packages, etc, and most of all I really need to finish this project soon...!

I understand this is an expected behavior, however I don't know any financial / charting software (TradingView, etc) that doesn't have an auto-resizing implementation that resizes the candles equally, center the wicks and leave an equal gap on both side of the bar.  I am not sure neither how they do it, maybe they limit the zoom scales to numbers that can be divided equally for resizing the candles.  I'll probably try to re-create some simple projects showing the different issues I have encountered during my project when this is over here.  For now, the GUI part is hopefully complete in my software and I will only be able to come back to this after everything is complete!..  Thanks for you understanding!! 

Have a great day
Martin Ivanov
Telerik team
commented on 03 Aug 2023, 06:50 AM

Thank you for the extra feedback. I understand your concern. Indeed, there are different techniques to avoid such issues and the chart implements some of these, but probably there is some room for improvement. When you have the time to setup a small sample that shows the gaps, please feel free to share it here or through the ticketing system.

No answers yet. Maybe you can help?

Tags
Chart
Asked by
Rick
Top achievements
Rank 1
Iron
Share this question
or