Trading Chart: Horizontal Scroll Bar Layered Over X Axis Labels
Moderator: Queue Moderators
- JeffFerguson
- Posts: 9
- Joined: Wed Oct 07, 2020 1:25 am
Trading Chart: Horizontal Scroll Bar Layered Over X Axis Labels
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 (16.21 KiB) Viewed 4655 times
-
- Posts: 141
- Joined: Wed Mar 27, 2019 1:05 pm
Re: Trading Chart: Horizontal Scroll Bar Layered Over X Axis Labels
Hello Jeff,
If that is LightningChart's own scrollbar component (HorizontalScrollBar), you can change its position via Alignment and Offset properties. For example:
Change the Offfset.Y to find the most suitable position for the scrollbar.
Best regards,
Lasse
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);
Best regards,
Lasse
- JeffFerguson
- Posts: 9
- Joined: Wed Oct 07, 2020 1:25 am
Re: Trading Chart: Horizontal Scroll Bar Layered Over X Axis Labels
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?
Is there a property on the chart that would give me the height of those X axis labels?
-
- Posts: 141
- Joined: Wed Mar 27, 2019 1:05 pm
Re: Trading Chart: Horizontal Scroll Bar Layered Over X Axis Labels
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
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