Segment Splitter in Normal Chart
Moderator: Queue Moderators
Segment Splitter in Normal Chart
There is a Segment Splitter that automatically displays on TradingChart, but doesn't seem to be available for a normal Segmented chart. Why is this? Could this be added? And in the meantime, is there any other way to visually separate y axis segments?
-
- Posts: 141
- Joined: Wed Mar 27, 2019 1:05 pm
Re: Segment Splitter in Normal Chart
Hello,
This kind of Segment Splitter can be added in normal LightningChart as well. Technically, TradingChart is build over regular LightningChart library, therefore everything you see in TradingChart can also be done in the normal chart.
The Segment Splitter is actually a ConstantLine object placed between two Y-axis segments. Here are the most important parts of the code used internally in TradingChart.
If you need to modify the heights of the segments by dragging the ConstantLine, as is done in TradingChart, subscribe to ValueChanged event (or alternatively MouseDown and MouseUp events) and adjust the segment heights inside the event.
There is actually one example in the normal chart, which uses ConstantLines as Segment Splitters. You could check "Multisegmented trading" in our Interactive Examples demo application.
Best regards,
Lasse
This kind of Segment Splitter can be added in normal LightningChart as well. Technically, TradingChart is build over regular LightningChart library, therefore everything you see in TradingChart can also be done in the normal chart.
The Segment Splitter is actually a ConstantLine object placed between two Y-axis segments. Here are the most important parts of the code used internally in TradingChart.
Code: Select all
_constantLine = new ConstantLine(_view, _view.XAxes[0], _view.YAxes[0]);
_constantLine.LineStyle.Width = 5;
_constantLine.LineStyle.Color = Colors.LightBlue;
_constantLine.ShowInLegendBox = false;
_constantLine.IncludeInAutoFit = false;
_constantLine.LimitYToStackSegment = false;
_constantLine.ValueChanged += _constantLine_ValueChanged;
_view.ConstantLines.Add(_constantLine);
There is actually one example in the normal chart, which uses ConstantLines as Segment Splitters. You could check "Multisegmented trading" in our Interactive Examples demo application.
Best regards,
Lasse
Re: Segment Splitter in Normal Chart
Thanks so much! I found that example and borrowed heavily from the code there. Now I can have working segment splitters on my normal LightningChart! Great!