Segment heights and minimum fixed value

A forum dedicated to WinForms version of LightningChart Ultimate.

Moderator: Queue Moderators

Post Reply
Niels Decker
Posts: 12
Joined: Mon Nov 22, 2021 8:12 am

Segment heights and minimum fixed value

Post by Niels Decker » Thu Jan 13, 2022 9:36 am

Hi, I have the following problem with segment heights:

I have a layout of three segments (A, B, C) with their heights being 0.05, 1, 1. All of the heights are of course relative values, not fixed ones. What I want is to assign a fixed minimum value (preferably in pixels) to segment A. I assume that I have to calculate that (relative) size from the ratio of the full height of the chart and the fixed minimum value somehow, but I am unsure how to do this. Is chart.ViewXY.GetGraphSegmentInfo().GraphHeight the full height of the chart in pixels? Any help is appreciated!

Best regards
Niels

ArctionKestutis
Posts: 552
Joined: Mon Mar 14, 2016 9:22 am

Re: Segment heights and minimum fixed value

Post by ArctionKestutis » Thu Jan 13, 2022 12:08 pm

You can use relative size (for each vertical/YAxes segment) by using Segmented YAxesLayout.
Example of such usage could be found in our Demo (Interactive Examples App). Here is the screenshot to one of them (ExampleYAxesLayouts)
ExampleYAxesLayouts
ExampleYAxesLayouts
ExampleYAxesLayouts.png (423.75 KiB) Viewed 4426 times

Niels Decker
Posts: 12
Joined: Mon Nov 22, 2021 8:12 am

Re: Segment heights and minimum fixed value

Post by Niels Decker » Fri Jan 14, 2022 7:45 am

And what exactly is chart.ViewXY.GetGraphSegmentInfo().GraphHeight in a segmented axis layout? What does the value represent and what unit is it in?

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

Re: Segment heights and minimum fixed value

Post by Arction_LasseP » Fri Jan 14, 2022 9:00 am

Hello Niels,

GetGraphSegmentInfo().GraphHeight returns the height of the whole graph area where the data is drawn (the area limited by margins/axes). The value is in pixels.

If you need to get the height of an individual segment, that can be done also via GetGraphSegmentInfo(). For example:

Code: Select all

var gsi = _chart.ViewXY.GetGraphSegmentInfo();
double segmentHeigth = gsi.SegmentBottoms[0] - gsi.SegmentTops[0];
The segment height is also in pixels.

Best regards,
Lasse

Post Reply