c# - Datetime X-axis for Boxplot series in TeeChart -
currently, have multiple boxplots in teechart have added so:
seriesindex = 0; foreach(var datagroup in datagroups) //each datagroup contains parametervalues @ specific point in time { var series = new box() { ... } var values = datagroup.parametervalues; series.add(seriesindex, values); seriesindex++; chart.series.add(series); }
i want convert x-axis uses datetime value (defined below):
var timeindex = datagroup.timeseriesindex;
however, box class's add method not support datetime values. , when use inherited (from base series class) add(datetime, double)
method (within foreach loop), datetime values become 12 december 31, 1899
recognize base value datetime.tooadate
. leads me believe not inputting data correctly series. can point me in right direction?
all datetime values become 12 december 31, 1899 recognize base value datetime.tooadate.
exactly, that's way vertical box plot works in teechart. x position determined position property, 0 default. achieve request should set position each box plot. can done assigning position property or via specific add method override shown in code snippet below. datetime labels, can set xvalues.datetime true , let teechart calculate labels automatically or use labels trick shown in code:
tchart1.aspect.view3d = false; var boxseries1 = new steema.teechart.styles.box(tchart1.chart); var boxseries2 = new steema.teechart.styles.box(tchart1.chart); var boxseries3 = new steema.teechart.styles.box(tchart1.chart); boxseries1.add(datetime.now.adddays(0).tooadate(), new double[6] { 3, 6, 8, 15, 19, 21 }); boxseries2.add(datetime.now.adddays(1).tooadate(), new double[4] { 5, 7, 12, 21 }); boxseries3.add(datetime.now.adddays(2).tooadate(), new double[5] { 6, 7, 8, 15, 21 }); // simple trick force custom axis labels on bottom axis. // in case, series titles steema.teechart.axislabelsitems labels = tchart1.axes.bottom.labels.items; labels.clear(); foreach (steema.teechart.styles.box b in tchart1.series) { b.xvalues.datetime = true; labels.add(b.position); } tchart1.axes.bottom.labels.datetimeformat = "dd/mm/yyyy hh:mm";