I have a datasource with Date and String as column datatypes. I have the axis as follows
<igChart:Axis AxisType="PrimaryX" AutoRange="True" />
<
igChart:Axis
AxisType
=
"PrimaryX"
AutoRange
"True"
/>
The datasource is generated dynamically so I have to bind it programatically. Whenever I set the datasource and try to draw the graph,
why is it that I see numbers instead of text or datetime on the X axis?
Also, how do I view labels for each of the data points on the chart?
Hi,
Can you add a new row to your table like:
row["StringDate"] = DateTime.Now.AddDays(i).ToString();
and then set your DataMapping like this:
seriesChart.DataMapping = "Label=StringDate;Value=UnitPrice";
-Marisa
Ok, so how do I implement this workaround? I cannot change my source table's datatypes. Can you explain me with the current example?
Currently setting Label to a DateTime object will not show the DateTime. You will have to convert the DateTime to a string first, and then set the Label to that string. We are currently working on a DateTimeAxis for our upcoming 11.1 release that should provide the functionality you are looking for.
Regards,
Marisa
Thanks Marisa, it works for Name. However for seriesChart.DataMapping = "Label=Date;Value=UnitPrice"; I still see the same issue.
Hi there,
You can achieve the functionality you are looking for by simply changing your DataMapping string in the code behind. If you change it to:
seriesChart.DataMapping = "Label=Name;Value=UnitPrice";
This should give you the desired effect of the Name column in your data showing as the axis labels and items in the legend. You will probably have to adjust the size of your DataChart to keep the axis labels from colliding.
Hope this helps!