Hi Dragan,
I got it working! Thank you very much. In order to avoid replicating the code multiple times for each graph, I modified the javascript binding code as follows:
$(document).ready(function () {
var ids = ['#incurredWC', '#reservesWC', '#incurredAL', '#reservesAL', '#incurredGL', '#reservesGL'];
for (i = 0; i < ids.length; i++ ) {
$(ids[i]).bind('tooltipFormat', function (e, data) {
return '$' + addCommas(data.y);
});
$(ids[i]).bind('axisLabelCreating', function (event, data) {
if (data.context.axis.location == 'left') {
data.text = '$' + addCommas(data.text);
}
});
}
});
The Javascript provided does not work for the tooltip on a pie chart however. When I include the IDs for my pie charts, the tooltip for a pie segment shows "$undefined". I am guessing this is because the data element passed to the addCommas function is not a pure number, but includes the legend title and percentage. Not a problem. I can probably parse the data passed to the binding function to split the number out of the legend and percent and then reformat.
Anyway, thank you again for your assistance. You have been extremely helpful.
Best regards,
Gene
Ok. I did some more investigating. Apparently, this technique only works for standard column charts. When I include a stacked column chart, the y-axis is rendered with commas. However, the tooltip shows commas, but now aggregates the bar with all previous segments below. If I don't include the graph in the binding list, the tool tip show the amount for just the one segment the mouse is hovered over. Also, it appears that the value passed to the tooltip bind is not a string, so I can't parse out the value to add commas to.
What are your thoughts?
Thanks,
Gene