I have a bar chart in a report, and I'm trying to color some of the bars (red) if they are below a certain value. The two options I am aware of for this are:
1) When NeedsDataSource is fired, populate my own ChartSeries as I iterate through a SqlDataReader. This allows me to set the FillStyle.MainColor for each ChartSeriesItem I add, and I can set it to Red if I want. HOWEVER, the short-coming here is that I see no way to control the XAxis labels for each data point, and I want them to display the associated date with each data point (they end up just being 1, 2, 3, 4, etc.).
2) In the NeedsDataSource event, set the DataSource to a DataView. This also allows me to set the XAxis.DataLabelsColumn property so that I can appropriately label my XAxis. HOWEVER, if I try to change the color of the bar in the ItemDataBound event by iterating through the series items and setting the color, it doesn't work. The color never changes. The color appears to be set the moment it is added to the chart, and is unalterable after that point.
Any solution to this dilemma?
Regards,
Scott
UPDATE: Okay, I have a solution. It certainly doesn't seem elegant, but it works, but I would still like to know if there is a more direct route. Seems like #2 above would be easiest, and just access the chart items once they've been added to change their color, but that doesn't seem to work.
The solution I came up with after reading this: http://blogs.telerik.com/blogs/08-06-20/formatting_radchart_labels.aspx
I set the XAxis.AutoScale to false, then manually add each of my ChartAxisItems and set the TextBlock.Text property to the text I want. This certainly doesn't seem intuitive.
Is there a better way?