Discontinued line graph - distinct legend

Jan 16, 2016 at 12:36 PM
Edited Jan 16, 2016 at 1:17 PM
Hello,
I'm trying to achieve a discontinuous graph (i.e for one Y there will be few lines (ranges from to, empty space, from to, ...) - something along like on this image:

Image

As you can see (hopefully) there is a small break between 18:00 and 19:00

for now, i create one new "AddLineGraph" for each range (with the same Pen color)
How should i approach this?
(as you can see i have 3 times the same item on legend - i want legend to be distinct),
foreach (var item in Something)
{
    var dateSpan = new List<DateTime>();
    dateSpan.Add(item.from_date);
    dateSpan.Add(item.to_date);

    var datesDataSource = new EnumerableDataSource<DateTime>(dateSpan);
    datesDataSource.SetXMapping(x => dateAxis.ConvertToDouble(x));

    var itemDataSource = new EnumerableDataSource<int>(dateSpan.Select(a => device.Id));
    itemDataSource.SetYMapping(y => y);
    CompositeDataSource compositeDataSource1 = new CompositeDataSource(datesDataSource, itemDataSource);

    plotterMain.AddLineGraph(compositeDataSource1,
        new Pen(brush, 2),
        new CirclePointMarker { Size = 2.0, Fill = Brushes.Red },
        new PenDescription(device.Name));
                    
}
Jan 18, 2016 at 4:32 AM
Hi,

(I can not see the image) any way Your approach is correct. This is the only way for DDD line graph. You have to add separate lines with same pen colour.
Since you added 3 separate lines, you will have 3 items in legend. Remove the legend from the chart and add your own legend, since this is wpf you can add your own legend very easily.(One grid and line and label inside grid and place this grid where ever you like, may be out side of the chart)

Regards
Ravi.