c# - Setting X axis start to first value in first series, Chart control -


i have chart control on windows form , changed data i'm adding x axis string representing date datetime type.

before changing set minimum x axis 1 one line starts @ y axis i'm using date can't same!

is there simple way start line on chart control @ y axis?

here doing , i'm trying:

chart2.chartareas[0].axisx.minimum = 1; 

and adding data chart thus:

seriesave.points.addxy(strdate, average); //strdate string, average double. 

i way:

seriesave.points.addxy(dt.date, average); datetime tpdate = datetimepicker1.value;  // results in cannot convert datetime double.  chart2.chartareas[0].axisx.minimum = tpdate.date;  

all x- , y-values in chart stored doubles.

when adding value as datetime gets converted double implicitly tooadate conversion function.

so when need set value minimum, maximum etc need call function in code:

chart2.chartareas[0].axisx.minimum = tpdate.date.tooadate();  

to convert datetime use datetime.fromoadate function:

 datetime tpdate = datetime.fromoadate( chart2.chartareas[0].axisx.minimum); 

Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -