c# - Range bar in MS Chart -


i want generate bars in link: enter image description here

however, error:

enter image description here

here code use:

        // axisy         chart1.chartareas.add(ca);         chart1.chartareas[1].axisy.majorgrid.enabled = false;         chart1.chartareas[1].axisy.interval = 1;          // axisx         chart1.chartareas[1].axisx.scrollbar.enabled = true;         chart1.chartareas[1].axisx.scaleview.zoomable = true;         chart1.chartareas[1].axisx.majorgrid.enabled = false;         chart1.chartareas[1].axisx.labelstyle.format = "yyyy-mm-dd hh:mm:ss";          chart1.chartareas[1].axisx.interval = 0;         chart1.chartareas[1].axisx.intervaltype = datetimeintervaltype.years;          mindate = new datetime(2016, 01, 01, 00, 00, 00, 000);         maxdate = new datetime(2016, 12, 01, 00, 00, 00, 000); // or datetime.now;          chart1.chartareas[1].axes[0].enabled = axisenabled.false;         chart1.chartareas[1].axes[1].enabled = axisenabled.false;          chart1.chartareas[1].backcolor = color.transparent;         chart1.chartareas[1].position.height = 100;         chart1.chartareas[1].position.width = 100;         chart1.chartareas[1].innerplotposition.height = 90;         chart1.chartareas[1].innerplotposition.width = 80;         chart1.chartareas[1].innerplotposition.x = 10;          var series2 = new series         {             name = "s2",             color = color.black,             charttype = seriescharttype.rangebar,             yvaluetype = chartvaluetype.auto,             xvaluetype = chartvaluetype.auto         };          var values2 = new datetime[3];         values2[0] = mindate.addmonths(2);         values2[1] = mindate.addmonths(4);         values2[2] = mindate.addmonths(6);          series2.points.addxy(1, values2[1], values2[2]);          series2["pointwidth"] = ".25";          chart1.series.add(series2); 

the bottom axis date time. left axis fixed , has words labels. need show gap in data.

yes, looks weird @ first glance , error message not pointing in right direction.

the reason try add points series before have added series chart.

rangebar cannot combined other chart type except bar-type charts.

therefore (?) chart can't check if points added in valid way , instead of saying claims series accepts 1 y-value.

solution: add series2 chart before adding datapoints , well..


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -