Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8242463
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T21:10:40+00:00 2026-06-07T21:10:40+00:00

I’m using the jqPlot AJAX JSON Data Renderer as described in: http://www.jqplot.com/tests/data-renderers.php . My

  • 0

I’m using the jqPlot “AJAX JSON Data Renderer” as described in: http://www.jqplot.com/tests/data-renderers.php.
My server side is Spring MVC. On the server I render a matrix of Object[][], each line of the matrix contains 2 objects: [LocalTime.toString(“HH:mm”), Integer]. Response is returned as “@ResponseBody”

I can see that the data is retrieved from the server and when I display it in an alert I see the following:

[["09:00",5],["09:30",5],["10:00",5],["10:30",5],["11:00",10],["11:30",10],["12:00",10],["12:30",10],["13:00",5]]

I also tried using List<List<Object>> instead of the array.
I cant get it to work. All I get is an empty chart.
Here is the javascript:

<script>
    $(document).ready(function(){
      var ajaxDataRenderer = function(url, plot, options) {
        var ret = null;
        $.ajax({
          async: false,
          url: url,
          dataType:"json",
          success: function(data) {
            ret = data;
          }
        });
        alert("OUT: " + ret);
        return ret;
      };
       var jsonurl = "chartData";

      var plot2 = $.jqplot('chart', jsonurl,{
        dataRenderer: ajaxDataRenderer,
        dataRendererOptions: {
          unusedOptionalUrl: jsonurl
        }
      });
    });
</script>

I saw in here JSON for jqPlot that everyone suggests to build a string and parse it. Is this the only way?
I also reviewed several similar questions but couldn’t find me an answer.
Will appreciate any hint…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T21:10:42+00:00Added an answer on June 7, 2026 at 9:10 pm

    This question was asked ages ago, so I assume you have moved on by now…but I was searching for this as well…and have just found the answer. Well…AN answer.

    The issue is that the thing you are passing back from ajaxDataRenderer stops looking like json when you put the dates in. I dont know why, but if you change dataType to text, then your alert will output the data. But the chart fails, because it isn’t set up to handle a string.

    so….you use eval, to force js to convert the string into an actual array, like this:

    var ajaxDataRenderer = function(url, plot, options) {
         var ret = null;
    
         $.ajax({
          // have to use synchronous here, else the function
          // will return before the data is fetched
          async: false,
          url: url,
          dataType:"text",
          success: function(data) {
              ret = data;
              }
        });
    
        //clear out the loading message from the div
        $('#chartdiv').empty();
        //evaluate the returned string...to turn it into the data structure.
        return eval(ret);
    };
    

    This worked for me anyway. I then made my url to return text representing the data.

    Hope this helps someone else searching for the answer to this!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using jqplot to show graphs in an accordion. http://www.jqplot.com/tests/UI.php When I just
I'm using jqPlot to render a graph with zooming enabled. For example: http://www.jqplot.com/tests/zooming.php In
I am using jqPlot javascript library ( http://www.jqplot.com/ ) for graphs and charts in
I'm (trying to) using JSON with PHP. I want to plot a graph using
I am using jqPlot to show candlestick chart and the data is from XML
I am using ajax to connect to a PHP script and then retrieve the
I tried to plot data useage per day using jqPlot along with its DateAxisRenderer
I am using below code to show Y axis of jqPlot at right side
I'm using jqPlot and I need to turn this JSON which I receive from
Im trying to learn php by doing a little project using apache server. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.