Trading Chart: Horizontal Scroll Bar Layered Over X Axis Labels

A forum dedicated to WPF version of LightningChart Ultimate.

Moderator: Queue Moderators

Post Reply
User avatar
JeffFerguson
Posts: 9
Joined: Wed Oct 07, 2020 1:25 am

Trading Chart: Horizontal Scroll Bar Layered Over X Axis Labels

Post by JeffFerguson » Thu Oct 15, 2020 9:32 pm

I have a trading chart to which I have added a horizontal scroll bar. The scroll bar is visible but is layered over the labels for the X axis. See attached screen shot. How do I move the scroll bar to reside below the labels?
Attachments
Screenshot 2020-10-15 163003.png
Screenshot 2020-10-15 163003.png (16.21 KiB) Viewed 4165 times

Arction_LasseP
Posts: 141
Joined: Wed Mar 27, 2019 1:05 pm

Re: Trading Chart: Horizontal Scroll Bar Layered Over X Axis Labels

Post by Arction_LasseP » Fri Oct 16, 2020 8:59 am

Hello Jeff,

If that is LightningChart's own scrollbar component (HorizontalScrollBar), you can change its position via Alignment and Offset properties. For example:

Code: Select all

            HorizontalScrollBar hsb = new HorizontalScrollBar(_tradingChart.GetInternalChart());
            hsb.Alignment = HorizontalScrollBarAlignment.BelowGraph;
            hsb.Offset.Y = 100;
            _tradingChart.GetInternalChart().HorizontalScrollBars.Add(hsb);
Change the Offfset.Y to find the most suitable position for the scrollbar.

Best regards,
Lasse

User avatar
JeffFerguson
Posts: 9
Joined: Wed Oct 07, 2020 1:25 am

Re: Trading Chart: Horizontal Scroll Bar Layered Over X Axis Labels

Post by JeffFerguson » Sat Oct 17, 2020 4:21 pm

Thanks you, Lasse. With that, I have a followup question.

Is there a property on the chart that would give me the height of those X axis labels?

Arction_LasseP
Posts: 141
Joined: Wed Mar 27, 2019 1:05 pm

Re: Trading Chart: Horizontal Scroll Bar Layered Over X Axis Labels

Post by Arction_LasseP » Mon Oct 19, 2020 8:34 am

Hello Jeff,

The height of the axis labels, as well as the interactive axis area, are fixed. The axis area height (between the graph and the time range buttons) can be read via:

double axisThickness = _chart.GetInternalChart().ViewXY.XAxes[0].AxisThickness;

The X-axis labels have a fixed height of 15 pixels. However, since they are not all in the same row (months and years on different rows), you need to take the row into account as well. In the source code this is calculated as follows:

marker.Offset.Y = TimeScaleRowHeight / 2 + rowIndex * TimeScaleRowHeight;

TimeScaleRowHeight is the constant 15 pixels. rowIndex is 0 for days, 1 for months and 2 for years.

Hope this helps.
Best regards,
Lasse

Post Reply