Advice needed for showing additional data stacked linegraph

A forum dedicated to WinForms version of LightningChart Ultimate.

Moderator: Arction_LasseP

ramon
Posts: 3
Joined: Tue May 29, 2018 7:41 am

Advice needed for showing additional data stacked linegraph

Post by ramon » Thu Jul 05, 2018 1:09 pm

Dear Arction,

we are in need of some advice with the implementation of the following scenario.

On the screen we have a line graph with a stacked YAxesLayout.
The chart will have multiple signals (ranging from 2 up to 10 or even 20), each shown in its own y-axis.

For each signal we will calculate some basic data: min value, max value, average value. We want to show the basic statistics values for each signal on the right hand side of the screen.
So basicly we will have this layout:

|
|Signal 3................................min: 1,
|..........................................max 3, avg: 2
|
|Signal 2................................min: 10,
|..........................................max: 30, avg: 20
|
|Signal 1................................min: 15,
|..........................................max: 15, avg: 15
|
|_____________________________________________


There are 2 approaches to show the values:
1) Keep the values inside the graph. The pro here is that we can add them to the correct Y-axis, and have an easier time of positioning them (especially Y position) ?
What would be the best approach here, use annotations?

2) Keep the values outside the graph. The challenge here though is to keep the values aligned to the proper signal, Y position wise.
The pro here is that we can style it exactly like we want, and keep it seperate from the graph.

Could you please advice?

Thanks in advance,

Ramon

Edit: dots added as spaces are not shown in the graph :)

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

Re: Advice needed for showing additional data stacked linegr

Post by ArctionKestutis » Mon Jul 09, 2018 1:12 pm

Sorry for the late reply. It was busy week so forum was neglected. Writing directly to Support account with SubscriptionID usually result in more speedy answer.

LightningChart has many ways to show the text on the chart. Besides Annotation, there are also SeriesEventMarkers, ChartEventMarkers, Series.Title, Axis.Title and several more less flexible options. The choice is yours, as it depends on flexibility you need and how important is rendering speed or memory footprint.

On paper, Annotation is most flexible object for this purpose. Its features include multiple lines of text, various shapes, filling with bitmap, positioning at screen or axis coordinates, automatic or manual sizing etc. The flexibility comes with the cost of being biggest object, which may affect memory consumption and speed of your app (especially with thousands of such objects).

(Series.)SeriesEventMarkers and (ViewXY.)ChartEventMarkers are simpler objects. They consist of symbol and label. They have many things in common, but serve different purpose due to small differences. ChartEventMarkers is more intended to put annotation-like marking on the chart: their positioning is relative and/or defined by screen coordinates. In contrast, SeriesEventMarkers collection (which is Line series property) is more attached to Series and Axis. SeriesEventMarkers have more diverse positioning and shape (added recently) options.

Title is just text label with fill rectangle. Its positioning options similar to ChartEventMarker.

Please go though our Demo App examples and explorer various usage of those objects. Please note that our Demo App has 'Properties' button at the top. This opens properties grid, which you can modify on-fly. Just open any example, select property grid and modify almost any property to your liking.

Whichever object you will choose, you will need some screen-coordinate and axis-value conversion. Below is list of methods, which could be useful.

You can measure size of rendered text in LightningChart with

Code: Select all

_chart.MeasureText(Text, Font)
[please note that output in DIP units; use DpiHelper.DipToPx() where needed].

After frame was rendered, you can read accurate information about segment heights with

Code: Select all

_Chart.ViewXY.GetGraphSegmentInfo();
// or
YAxis.GetGraphSegmentTopAndHeight(out fSegTop, out fSegHeight);
Following methods will help you with Value <-> Coordinates conversion

Code: Select all

Axis.ValueToCoord() 
Axis.CoordToValue()
(just check all arguments to control PX/DIP unit usage).

Hope this helps.
All the best.