Example #1
0
        private IReadOnlyCollection <ChartString> SplitOnLines(GanttChartModel model)
        {
            var result = new List <ChartString>();
            int i      = 0;

            for (DateTime startTime = model.StartChartTime; startTime < model.EndChartTime; startTime = startTime.AddHours(1))
            {
                var chartString = new ChartString(startTime, startTime.AddMilliseconds(3599999), i++);
                foreach (var graph in model.Graphs)
                {
                    chartString.AddGraph(graph.Name, graph.Intervals.ToSplitBoundaryIntervals().ToArray());
                }
                result.Add(chartString);
            }
            return(result);
        }
        private static void DrawInterval(Graphics gr, Interval interval, int graphNum, ChartString chartString)
        {
            var stringY   = height - margin - (chartString.Num * stringHeight);
            var lineY     = stringY - (graphNum + 1) * stringHeight / (chartString.Graphs.Count + 1);
            var lineStart = pixelsPerSecond * chartString.GetStartCoord(interval) + margin;
            var lineStop  = pixelsPerSecond * chartString.GetEndCoord(interval) + margin;
            var pen       = new Pen(diagramColors[graphNum], 5);

            if (interval.Level == 0)
            {
                pen = new Pen(Color.Red, 5);
            }
            gr.DrawLine(pen, Convert.ToInt32(lineStart), lineY, Convert.ToInt32(lineStop), lineY);
        }