walter Posted December 6, 2007 Report Share Posted December 6, 2007 Dear CharFX Group, I have two series, one (DateTime) for label and one (double) for value. The following is the code and the generated chart inXChartObj.DataSourceSettings.DataType[0] = DataType.Label; inXChartObj.DataSourceSettings.DataType[1] = DataType.Value; inXChartObj.DataSourceSettings.DataSource = inSourceDataTableObj; inXChartObj.AxisX.LabelsFormat.Format = AxisFormat.DateTime; inXChartObj.AxisX.LabelsFormat.CustomFormat = "yyyy/MM/dd HH:mm"; http://www.wretch.cc/album/show.php?i=isponder&b=11&f=1310563676&p=4 The AxisX only displays Year/Month/Day but no Hour and Minute. Please help me on this. Thanks in advance. Link to comment Share on other sites More sharing options...
maximop Posted December 11, 2007 Report Share Posted December 11, 2007 You need to also format the data passed to the x-axis. Try adding below the LabelsFormat, the following two lines: inXChartObj.AxisX.DataFormat.Format = AxisFormat.DateTime; inXChartObj.AxisX.DataFormat.CustomFormat = "yyyy/MM/dd HH:mm"; Link to comment Share on other sites More sharing options...
walter Posted December 11, 2007 Author Report Share Posted December 11, 2007 Dear maximop, Thanks for your response. Unfortunately, DataFormat didn't work. But i found a workaround : set LabelsFormat before setting DataSource inXChartObj.DataSourceSettings.DataType[0] = DataType.Label; inXChartObj.DataSourceSettings.DataType[1] = DataType.Value; inXChartObj.AxisX.LabelsFormat.Format = AxisFormat.DateTime; inXChartObj.DataSourceSettings.DataSource = inXYValueDataTableObj; inXChartObj.AxisX.LabelsFormat.CustomFormat = "yyyy/MM/dd HH:mm"; everything works perfact. but i can't figure out why !? Link to comment Share on other sites More sharing options...
maximop Posted December 12, 2007 Report Share Posted December 12, 2007 DateTime objects in ChartFX are actually set to the double representation of that date; therefore, when passing XValues to the x-axis, you need to instruct ChartFX that the x-axis will contain DateTime values so they can be properly formatted. As you already know, this is done before binding the data to the chart. The same applies when setting the chart's DataTypes. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.