Three Days with Google Chart API and .NET 2.0: A Love-Hate Story

I just spent three full days wrestling with the Google Chart API inside a .NET 2.0 web app. What I learned? I have to share — keeping this to myself would be a digital crime.

Here’s the hard truth: Google Chart API and .NET 2.0 don’t play nice together.

Why?  

Because .NET 2.0 has zero built-in JSON support, and the Google Chart API lives on JSON. You can probably hack something together with custom parsers or third-party libraries — but if you're on a deadline (like I was), that’s a rabbit hole you don’t want to fall into.

But I didn’t walk away empty-handed.


The Workaround That Saved Me

If you’re stuck maintaining a legacy .NET 2.0 app and need Google Charts today, here’s the least painful path:

   Pre-render chart URLs server-side using query strings.

Yes — old-school, but 100% compatible.

Instead of sending JSON payloads, construct the full chart URL manually using the [Image Chart API (deprecated but still functional)](https://developers.google.com/chart/image/docs/making_charts) or switch to the modern Google Charts loader with `<img>` tags.


Example (VB.NET / C# .NET 2.0):

string chartUrl = "https://chart.googleapis.com/chart?"

    + "cht=p3" // pie chart

    + "&chs=500x300"

    + "&chd=t:60,25,15"

    + "&chl=Sales|Marketing|Support"

    + "&chtt=Team+Performance";


imgChart.ImageUrl = chartUrl;


No JSON. No JavaScript required on the server. Just a plain image tag.


It’s not fancy. It’s not interactive.  

But it works — reliably — in .NET 2.0.

---

Final Takeaway

If you control the stack, upgrade past .NET 2.0 (please).  

If you’re in legacy hell like me — embrace the query-string life.

Sometimes the oldest tools are the most reliable.

Drop a comment if you’ve survived .NET 2.0 integration nightmares — I need to know I’m not alone.








Popular posts from this blog

I have Youtube Channel