Creation of timeline chart

A forum dedicated to WinForms version of LightningChart Ultimate.

Moderator: Queue Moderators

Post Reply
hallo888
Posts: 43
Joined: Wed Mar 26, 2014 10:56 am

Creation of timeline chart

Post by hallo888 » Mon Apr 28, 2014 12:05 pm

Hi

I'm trying to create a timeline chart to represent the on/off time of say 50 machines. Machine A turns on from the 2nd hour to 10th hour, and then from 15th hour to 23rd hour. Machine B turns on from 0 hour to 8th hour, and then from 10th hour to 15th hour. And so on.

Is the bar chart able to achieve my objective? How do i go about doing it?
If the bar chart is not suitable, what should i use?

Thank you.

User avatar
ArctionPasi
Posts: 1367
Joined: Tue Mar 26, 2013 10:57 pm
Location: Finland
Contact:

Re: Creation of timeline chart

Post by ArctionPasi » Mon Apr 28, 2014 12:23 pm

I'd suggest using LineCollections. One LineCollection for A, one for B. Line collection can have many lines. Each line collection can be colored with specific color, like red for A and blue for B.

LineCollection consists of SegmentLines, and each of them has two position: start and end point.
LightningChart Support Team, PT

hallo888
Posts: 43
Joined: Wed Mar 26, 2014 10:56 am

Re: Creation of timeline chart

Post by hallo888 » Tue Sep 16, 2014 1:43 am

Hi Parsi,

I have implemented using line collections as you suggested for what i require. With that is mind, is there any way for me to achieve as shown in the attachment, where 1 line is a solid line (grey line) while the other line only have outlines (red lines), using line collections?

Please advise.
Attachments
graph.png
graph.png (10.36 KiB) Viewed 8843 times

User avatar
ArctionPasi
Posts: 1367
Joined: Tue Mar 26, 2013 10:57 pm
Location: Finland
Contact:

Re: Creation of timeline chart

Post by ArctionPasi » Tue Sep 16, 2014 5:13 am

It should be possible but may prove out very difficult to align the red lines accurately in the edge of the gray bars. Series values are follow axis values. Use YAxis.ValueToCoord to get the Y center coordinate of the gray bar, say that's yGC.

Top of gray bar is then yGT = yGC - grayLineCollection.LineStyle.Width / 2.
Gray bar bottom is yGB = yGC + grayLineCollection.LineStyle.Width / 2

Then let's determine the red line center Y screen coordinates.
yRT = yGT - redLineCollection.LineStyle.Width / 2.
yRB = yGB + redLineCollection.LineStyle.Width / 2.

Use yAxis.CoordToValue to convert yRT and yRB in axis values, and set the red line collection's SegmentLine points based on the result.

Something like that perhaps.
LightningChart Support Team, PT

Post Reply