Search code examples
c#wpfchartsnevron

Chart For Special Time During A Day


I'm trying to draw a chart for a collection of DateTime(x) -> Double(y).

Dates are between 8:00 AM and 2:00 PM, so I want to see this duration in the chart, remove 2:00 PM to 8:00 AM for every Date, like this (Date is converted in this picture (wrong Date):

enter image description here

Correct date:

enter image description here

I tried to draw this with Nevron Chart, but I couldn't.

Does anyone who knows how to do this especially with Nevron or any other chart? Which chart component provides this feature?

Thanks for your help.


Solution

  • You can look at the Nevron Chart Daily Schedule Work Calendar example. The example demonstrates how to use the daily schedule of the work calendar in order to skip hourly ranges for which there is no data.

        // create a timeline scale
        NRangeTimelineScaleConfigurator rangeScale  = new NRangeTimelineScaleConfigurator();
        rangeScale.EnableCalendar = true;
    
        // create a rule
        NWeekDayRule wdr = new NWeekDayRule();
        wdr.Saturday = false;
        wdr.Sunday = false;
    
        // set shedule non working hours
        wdr.Schedule.SetHourRange(0, 9, true);
        wdr.Schedule.SetHourRange(12, 13, true);
        wdr.Schedule.SetHourRange(18, 24, true);
    
        rangeScale.Calendar.Rules.Add(wdr);