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 9131843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:12:38+00:00 2026-06-17T08:12:38+00:00

I am trying to write a renderer function as a test for JSON. The

  • 0

I am trying to write a renderer function as a test for JSON. The example code for jqplot works fine for a single line, but I want to be able to replace my existing data (4 different plots, 2 lines, 2 bar charts) with JSON loading.

An example of the test render functions are below (simplified to return COS/SIN data to test charting).

var SampleLine = function()
{
    var data=[[]];
    for(var i=0; i<13; i+=0.5)
    {
        data[0].push([i, Math.sin(i)]);
    }
    return data;
};

var SecondLine = function()
{
    var data=[[]];
    for(var i=0; i<13; i+=0.5)
    {
        data[0].push([i, Math.cos(i)]);
    }
    return data;
};

var plot3 = $.jqplot('chartdiv', [],
        {
            title:'JSON Test',
            dataRenderer: SecondLine,

            axes: {
                xaxis: {
                    renderer: $.jqplot.CategoryAxisRenderer,
                    label:'Date',
                    labelRenderer: $.jqplot.CanvasAxisLabelRenderer,
                    labelOptions: {
                        fontFamily: 'Georgia, Serif',
                        fontSize: '12pt'
                    },
                },
                yaxis:{
                    label:'Units',
                    labelRenderer: $.jqplot.CanvasAxisLabelRenderer,
                    labelOptions: {
                        fontFamily: 'Georgia, Serif',
                        fontSize: '12pt'
                    },
                }
            },
            series:[
                {
                    showMarker:true,
                    markerOptions: { style:'circle' },
                },
                {
                    renderer:$.jqplot.BarRenderer,
                },
                {
                    renderer:$.jqplot.BarRenderer,
                },
                {
                    showMarker:true,
                    markerOptions: { style:'square' },
                },
            ],
        }
);

My question is how to add the second dataRenderer as I need data from different sources to combine the lines and bars on a graph. Hard setting the arrays works, but I am trying to do this with AJAX/JSON to get data from my DB, and other sources.

  • 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-17T08:12:39+00:00Added an answer on June 17, 2026 at 8:12 am

    I don’t know what is dataRenderer, and JQPlot doc also.

    You can add or remove series by playing with plot1.series array.

    Here is a good jsfiddle : jsfiddle.net/fracu/HrZcj

    The idea is to create an array with data

    for(var i=0 ; i<50 ; i++)
    {
        myNewSerie = Array();
        x = (new Date()).getTime();
        y = Math.floor(Math.random() * 100);
        myNewSerie.push([x, y]);
    }
    

    Then add it to the graph using the next available slot

    plot1.series[plot1.series.length] = myNewSerie
    

    And finally redraw using plot1.replot();

    Check the updateSeries function out in the end of the fiddle

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

Sidebar

Related Questions

I am trying write a function that generates simulated data but if the simulated
I'm using the ajaxtoolkit:Rating. It all works fine except I'm trying to write a
I m trying write code that after reset set up rrpmax as 3000. It
Trying to write out syslog entries containing strings but they don't register. // person.name
Trying to write a function to see how often an object exists and give
Trying to write a code at the moment that basically tests to see if
I'm trying to write an item renderer (in Flash Builder 4.6) purely in action
I am trying to write a basic volume renderer which uses opengl, and cg
I am trying to write a renderer which would process the placeholder attribute on
Developing server side code i finally got my eyes X-crossed trying to write -

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.