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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T02:53:01+00:00 2026-06-08T02:53:01+00:00

I have to plot a graph of time and value coming from an ajax

  • 0

I have to plot a graph of time and value coming from an ajax request, i need to know how to show the data to the highcharts, please find the below code:

JSP FOR GETTING DATA:

<%@ page import = "com.qdx.eqc.vo.*, com.qdx.eqc.proxy.EQCProxyClient, java.util.*" %>
<%

    System.out.println("Inside landingAjax.jsp");
    String productionID = request.getParameter("productionID");
    System.out.println("productionID = "+productionID);
    String instrumentID = request.getParameter("instrumentID");
    System.out.println("instrumentID = "+instrumentID);
    String testId = request.getParameter("testId");
    System.out.println("testId = "+testId);
    String instrType = request.getParameter("instrType");
    System.out.println("instrType = "+instrType);
    String testInstrTypeId = request.getParameter("testInstrTypeId");
    System.out.println("testInstrTypeId = "+testInstrTypeId);
    String departmentId = request.getParameter("departmentId");
    System.out.println("departmentId = "+departmentId);

    EQCProxyClient client = new EQCProxyClient();
    ResponseVO responseVO = null;

    //Graph data for patinetbias START
    responseVO = client.getPatientBiasData(productionID,instrumentID,testId,instrType,testInstrTypeId,"7.0",departmentId);
    ArrayList xAxis = new ArrayList();
    ArrayList lines = new ArrayList();
    ArrayList dateTime = new ArrayList();
    ArrayList doubleValue = new ArrayList();
    Date duration = new Date();
    Iterator itt=responseVO.getResponse().iterator();
    while(itt.hasNext()){
        PatientBiasDataVO po = (PatientBiasDataVO)itt.next();
        xAxis = po.getPatientBiasData();
        Iterator biasItr = xAxis.iterator();                                                    
                while(biasItr.hasNext())
                {
                    BiasDataVO biasData = (BiasDataVO)biasItr.next();
                    if(biasData.getStrDateTime()!=null)
                    {
                    dateTime.add(biasData.getStrDateTime());

                    }
                    doubleValue.add(biasData.getValue());

                }
        lines = po.getVerticalLines();
        duration = po.getDateTime();
        System.out.println(" xAxis "+ xAxis + " lines " + lines + "duration" + duration );
    }
    out.print(doubleValue.toString()+','+dateTime.toString()); /// THESE IS THE GRAPH DATA as VALUE AND TIME

%>

JAVASCRIPT FOR AJAX & HIGHCHARTS:

<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">
    $(document).ready(function(){alert('came in');
           var options = {
                    chart: {
                        renderTo: 'right1',
                        type: 'spline',
                        marginRight: 10,
                    },
                    credits: {
                        enabled: false
                    },
                    title: {
                        text: 'Patient Bias Display'

                    },
                    xAxis: {
                        type: 'datetime',
                        tickPixelInterval: 150
                    },
                    yAxis: {
                        title: {
                            text: 'Bias'
                        },
                        plotLines: [{
                            value: 0,
                            width: 1,
                            color: '#808080'
                        }]
                    },
                    tooltip: {
                        formatter: function() {
                                return '<b>'+ this.series.name +'</b><br/>'+
                                Highcharts.dateFormat('%Y-%m-%d %H:%M:%S', this.x) +'<br/>'+
                                Highcharts.numberFormat(this.y, 2);
                        }

                    },
                    legend: {
                        enabled: false
                    },
                    exporting: {
                        enabled: false
                    },
                    plotOptions: {
                        color: '#F3F70E'
                    },
                    series: []

            };

           var productionID = document.getElementById('productionID').value;
           var instrumentID = document.getElementById('instrumentID').value;
           var testId = document.getElementById('testId').value
           var instrType = document.getElementById('instrType').value;
           var testInstrTypeId = document.getElementById('testInstrTypeId').value;
           var departmentId = document.getElementById('departmentId').value;

            var url = "landingAjax.jsp";
            url = url+"?productionID="+productionID+"&instrumentID="+instrumentID+"&testId="+testId+"&instrType="+instrType+"&testInstrTypeId="+testInstrTypeId+"&departmentId="+departmentId;
            alert(url);
            $('#highCharts').click(function() {alert('clicked'); // CLICKED is alerted
                $.getJSON(url, function(data) {alert(url);    //THis alert doesnt work

How to fill data in X-Axis and Y- Axis??
var series = { data: []};

                        options.series.push(series);

                    var chart = new Highcharts.Chart(options);
                });
            });
    });
    </script>

I need to know how to accumulate data in x and y axis to plot the graph, please refer to my comments above.

Help me out guys.. if anything not understood; please have in comments… Thanks!!!

  • 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-08T02:53:02+00:00Added an answer on June 8, 2026 at 2:53 am

    here is how i do it my way … you may find a better way of doing it

    • i do a javascript ajax call to the server
    • put your chart in a function call it any thisng like drawchart()
    • pass your callback to that function

    notice

    to fill the x axis you need to end up having an array looks like this

         xAxis: {
            categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
                'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
        },
    

    and for every element in this array you need to pass a value to your series data[1,2,3,....]

    EXAMPLE

        $.ajax({
                type: "POST",
                url: "YOUR WEB SERVICE ",
                data: "",
                dataType: "json",
                contentType: "application/json; charset=utf-8",
    
                success: function (myvalue) { 
                   drawchart(myvalue) ; 
    
                  }});
    

    you also need to read this

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

Sidebar

Related Questions

I have the data in two files. I want to plot a graph the
I have a graph library that I use to plot some data. This data
I have a time series data that can plot using: plot(x$numbers, type=l, col=blue) I
I'm trying to plot a chart to show time against temperature using highcharts. I
I have a highcharts line graph that shows sales data. Is there a way
With this approach. I have a line plot graph. I want to plot 'two'
I am trying to plot a graph using gnuplot. I have six text files.
I have created a graph using core plot. Graph is shown in on the
I'm writing android app, which drawing 4 graphs in 1 plot. Graph data is
I have created a scatter graph with three plot spaces. One for two y-axis

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.