ASP Charting Settings for SharePoint

So, we’ve a customer who wanted a cheap and cheerful Polling web part. I’d seen one before on Codeplex by Phil Wicklund, and more recently I’d noticed the SPUserPoll by Edwin Vriethoff web part also on Codeplex. (I might try to review it at some point soon).


Both these web parts look kind of similar. They should do – they use the same control to display the charts – the ASP Chart control in System.Web.UI.DataVisualization.Charting library.

MSDN doesn’t seem to have much info on this; it implies that it’s part of the .NET 4 beta, but it is definitely available in 3.5 – Scott Gu says so, and observation shows he’s right!

We had a problem, though, on one of our system that sometimes the chart image would be displayed correctly – but most of the time you just got an ‘error’ box where the image should be. If you kept refreshing the page, occasionally it would show the image, but mostly it showed the error box – but it seemed pretty random as to when it would work or not.

It struck me that I should understand the configuration I’d put into the Web.Config. While doing this, I noticed that the value for the ‘ChartImageHander’ setting was

<add key="ChartImageHandler" value="Storage=memory;Timeout=20;" />

I wondered what the storage options were. I mean, if there were multiple servers you’d be relying upon Sticky Sessions to get the right server that has your image stored. Well, I found this blog post (and later, this documentation) that describes it. I noticed:

memory: Store the rendered chart images in the memory space of the running process. Do not use this option in a server cluster or a multiple-process site.

That’s enough to make me suspicious. Instead, I created a directory to hold the chart files, and used

<add key="ChartImageHandler" value="Storage=file;Timeout=20;Dir=c:charttemp" />

One additional note – I’m not sure if the ChartImageHandler should also include ‘DeleteAfterServicing=false’ to act like a cache. Sure, the chart wouldn’t get updated right away each time – but neither would it have to be rendered so often. I might look into that at some point…

ASP Charting Settings for SharePoint

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s