c# - How To Place Multiple Gantt Chart Bars On Same Row? -


i have gantt chart displays dates of work requests. i've been asked modify gantt chart display days work performed. example, wr #1 begins 2/8/2016 , ends 2/25/2016. however, work performed mon-thur. current gantt chart shows bar 2/8/2016 2/25/2016. break bar displays 2/8-2/11, 2/15-2/18, , 2/22-2/25. display single work request on 1 line. possible use seriescharttype.rangebar this, or have use different chart type? tried create series using multiple datapoint objects same xvalue, when added series chart each datapoint displayed on separate row. doing incorrectly?

here code using chart setup:

using system.windows.forms.datavisualization.charting; ... series series1 = new series(); series1.chartarea = "default"; series1.charttype = seriescharttype.rangebar; series1.yvaluesperpoint = 2; series1.yvaluetype = chartvaluetype.date; 

first attempt:

// wr #1 datapoint dp0 = new datapoint(0, new double[] { startdate0, stopdate0 }); datapoint dp1 = new datapoint(0, new double[] { startdate1, stopdate1 }); datapoint dp2 = new datapoint(0, new double[] { startdate2, stopdate2 });  // wr #2 datapoint dp3 = new datapoint(1, new double[] { startdate3, stopdate3 }); datapoint dp4 = new datapoint(1, new double[] { startdate4, stopdate4 }); datapoint dp5 = new datapoint(1, new double[] { startdate5, stopdate5 });  series1.points.add(dp0); series1.points.add(dp1); series1.points.add(dp2); series1.points.add(dp3); series1.points.add(dp4); series1.points.add(dp5);  chart1.series.clear(); chart1.series.add(series1); 

i have few hundred work requests, naturally use loop create each datapoint each work request , add series.

try this:

    private void form1_load(object sender, eventargs e)     {         chart1.series[0].points.addxy(1, new object[] { new datetime(2016, 2, 8), new datetime(2016, 2, 25) });         chart1.series[0].points.addxy(2, new object[] { new datetime(2016, 2, 8), new datetime(2016, 2, 11) });         chart1.series[0].points.addxy(2, new object[] { new datetime(2016, 2, 15), new datetime(2016, 2, 18) });         chart1.series[0].points.addxy(2, new object[] { new datetime(2016, 2, 22), new datetime(2016, 2, 25) });     } 

enter image description here


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -