Skip to content

Looking at Pie Charts in JQPlot extensively for ASP.NET and how the browsers render it Part 2

May 10, 2012

Today, I had spent as like yesterday, working out as to why Google Chrome was not rendering the JQPlot charts for time and date rendering on the x-axis more than once, it seems after the first chart, nothing appears.

Here were my attempts in my solution to find out why: –

1) I copied in the code to test that the web browser checks to see if the user is using Google Chrome.

        var is_chrome = navigator.userAgent.toLowerCase().indexOf(‘chrome’) > -1;
        if (is_chrome > 0) {
            alert(‘hi chrome!’);

This was an initial testing ground, didn’t do anything else other than check that its Google Chrome.

2) From yesterday, I had written the data in a public string field called Data in to the code behind and stored this in a javascript variable, it worked for Firefox and IE9 but not for Chrome.

3) Today, this may seem long winded but it was an attempt nevertheless, I wanted to use the old style web control of embedding the JQPlot line graph into the aspx page, and use JSON to POST the data from the web control (ascx) page, in turns out it was forbidden by ASP.NET as it gave an error “This type of page is not served” in the web developer tool kit. So as a “get around” solution I made a POST to another seperate aspx web page with nothing inside it to handle the JSON POST. This worked….for Firefox and IE9 but not want I initially intended for which was Google Chrome hence my efforts were wasted.

However I did learn that you can pass JSON string as data input into the JSON POST to another page (with web calls), and you can use the query string in Javascript to be passed in which was what I needed to do.

   $.ajax({ type: "POST",
        url: "PostingPage.aspx/Test",
        data: JSON.stringify({ input: querystring}),
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function (response) {
            if (response.d == true) {
            } else {
        error: function (xhr) {

As you can see i named PostingPage.aspx as where the page is POSTED to using JSON, and has a JSON input called “input”, and querystring which is the value you wish to place in, using the notion of JSON.stringify. Simply having { input: querystring } didn’t work as JSON didn’t recognised the text format for this in Javascript.

And also that there is a bug on Google Chrome when making JSON calls to the line graph with more than one chart!! I didn’t find out as to why that error had occured!!



From → Uncategorized

Leave a Comment

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

%d bloggers like this: