Improving ChartBuilder's cultural sensitivity [ChartBuilder app/source updated!]
Kind readers Eugenio and Thimp independently reported that the initial version of ChartBuilder did not work well on machines with certain culture settings. Specifically, ChartBuilder was inadvertently using the CurrentCulture for formatting numbers in XAML and that's a problem because the XAML is parsed according to the InvariantCulture. For example, on German machines ChartBuilder would write a double value to XAML as "1,23" according to the German culture settings - and the XAML parser would complain that wasn't a valid value. I'm usually able to catch problems like this by running code analysis and fixing all the Microsoft.Globalization warnings like CA1305, but in this case the code was calling objectInstance.ToString()
which doesn't have any IFormatProvider-based overloads and therefore generates no warnings.
My sincerest apologies to anyone who was affected by this problem. I have switched one of my machines to the German locale and will leave it there for a couple of days as punishment. :)
I made the culture fix on my bus ride this morning and had a bit of extra time, so I also made the following improvements:
- Added support for the
Axis.Interval
property. Now it's possible to customize the frequency of the labels, tickmarks, and gridlines on an axis. - Added the "datavis" xmlns prefix so it's already present for people who might need to reference it. [Like me when I posted a sample to the forums the other day. :) ]
- Updated the version to 2008/11/06.
Again, sorry for any trouble. I hope the updated ChartBuilder works well for everyone - and that you enjoy the minor improvements!
You can click this text or the image below to run the latest ChartBuilder in your browser.
[And click here to download the complete ChartBuilder source code.]