.net - How can I have a single column on a column chart using MSCharts (within an Asp.Net application)? -


i'm using following code generate chart:

public actionresult generatechart() {     var chart = new chart();     chart.antialiasing = antialiasingstyles.all;     chart.textantialiasingquality = textantialiasingquality.high;     chart.width = 500;     chart.height = 400;      chartarea area = new chartarea();     area.axisy.labelstyle.format = "{0:c}";      chart.chartareas.add(area);      series serie = new series();     serie.charttype = seriescharttype.column;     serie.points.databindxy(data, "year", data, "amount");     chart.series.add(serie);      using (var stream = new memorystream())     {         chart.saveimage(stream, chartimageformat.jpeg);         return file(stream.toarray(), "image/jpeg");     } } 

it's simple column chart data sum of amount (y-axis) per year (x-axis).

the data variable supplied while testing code has 1 item. item represents year 2015 amount of little bit on 9.000 (no pun intended).

as can see image generated below, despite having data 1 year, chart automatically adds previous year , next one.

how can show 2015? or @ least hide points/labels programatically? why adding information?

thanks in advance.

sample chart generated

try disabling margin on x axis

area.axisx.ismarginvisible = false;


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -