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

  • Home
  • SEARCH
  • 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 6604939
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:13:25+00:00 2026-05-25T19:13:25+00:00

I have a MySQL database with some price data in it I would like

  • 0

I have a MySQL database with some price data in it I would like to display using HighCharts/HighStock yet I’m not sure how I can actually go about getting this data from MySQL (via DBslayer as the JSON layer) and display in high charts (the example I found on their site isnt helpful and searching around there are no good tuts).

So essentially the system looks like this:

MySQL <---> DBSlayer Service <---> JSON Requests to DBSlayer <---> Web page with charts - send query to DBSLayer

The MySQL View which DBSlayer queries in a nutshell looks like this:

DATE TIME | Symbol1 | Price 1 | Symbol2 | Price 2 | Price3
2011-09-01| ABC     | 12.3    | XYZ     | 67.8    | 0.0852

Or a better example is the returned JSON from a query to DBSlayer:

  {"RESULT" : {"HEADER" : ["id" , , "authorID" , "msgDate" , "obj_obj" , "obj_subj" , "obj_diff" , "subj_pos" , "subj_neg" , "subj_diff" , "pos_lex" , "neg_lex" ] , 
    "ROWS" : [["4e0f1c393bfbb6aa4b7278c2" , "27" , "2011-06-30 13:59:47" , 0.0275171 , 0.972483 , -0.944966 , 0.993814 , 0.00618577 , 0.987628 , 1 , 0 ] ,
     ["4e0f1c393bfbb6aa4b7278c3" , "36324" , "2011-06-30 13:59:31" ,  0.364953 , 0.635047 , -0.270095 , 0.0319281 , 0.968072 , -0.936144 , 3 , 1 ] ,
     ["4e0f1c393bfbb6aa4b7278c4" , "12134" , "2011-06-30 13:59:28" ,  0.0112589 , 0.988741 , -0.977482 , 0.857735 , 0.142265 , 0.715469 , 1 , 1 ] ] ,
     "TYPES" : ["MYSQL_TYPE_VAR_STRING" , "MYSQL_TYPE_VAR_STRING" , "MYSQL_TYPE_DATETIME" , "MYSQL_TYPE_DOUBLE" , "MYSQL_TYPE_DOUBLE" , "MYSQL_TYPE_DOUBLE" , "MYSQL_TYPE_DOUBLE" , "MYSQL_TYPE_DOUBLE" , "MYSQL_TYPE_DOUBLE" , "MYSQL_TYPE_DOUBLE" , "MYSQL_TYPE_LONG" } , "SERVER" : "db-webPrices"}

How should I deploy this to High Charts? Should I use Node.js to wrap the query first (there are Node.js to DBSlayer libs however they dont work with the newest version of Node.js.

How would I use JQuery to get this data and format for a HighStock chart like this one: http://www.highcharts.com/stock/demo/multiple-series/gray

The basic HighCharts Demo using a CSV file as a data source looks like this:

    $(function() {
        var seriesOptions = [],
            yAxisOptions = [],
            seriesCounter = 0,
            names = ['DJI', 'SENTIMENT', 'GOOG', 'GS', 'SENTIMENT-Z', 'DJI-Z'],
            colors = Highcharts.getOptions().colors;

        $.each(names, function(i, name) {

            $.get(name +'.csv', function(csv, state, xhr) {

                // inconsistency
                if (typeof csv != 'string') {
                    csv = xhr.responseText;
                } 

                // parse the CSV data
                var data = [], header, comment = /^#/, x;

                $.each(csv.split('\n'), function(i, line){
                    if (!comment.test(line)) {
                        if (!header) {
                            header = line;
                        }
                        else {
                            var point = line.split(';'), date = point[0].split('-');

                            x = Date.UTC(date[2], date[1] - 1, date[0]);

                            if (point.length > 1) {
                                // use point[4], the close value
                                data.push([
                                    x, 
                                    parseFloat(point[4])
                                ]);
                            }
                        }
                    }
                });

                seriesOptions[i] = {
                    name: name,
                    data: data,
                    yAxis: i
                };

                // create one y axis for each series in order to be able to compare them
                yAxisOptions[i] = {
                    alternateGridColor: null,
                    gridLineWidth: i ? 0 : 1, // only grid lines for the first series
                    opposite: i ? true : false,
                    minorGridLineWidth: 0,
                    title: {
                        text: name,
                        style: {
                            color: colors[i]
                        }
                    },
                    lineWidth: 2,
                    lineColor: colors[i]
                };

                // As we're loading the data asynchronously, we don't know what order it will arrive. So
                // we keep a counter and create the chart when all the data is loaded. 
                seriesCounter++;

                if (seriesCounter == names.length) {
                    createChart();
                }
            });
        });



        // create the chart when all data is loaded
        function createChart() {

            chart = new Highcharts.StockChart({
                chart: {
                    renderTo: 'container',
                    alignTicks: false
                },

                rangeSelector: {
                    selected: 1
                },

                title: {
                    text: null
                },

                xAxis: {
                    type: 'datetime',
                    maxZoom: 14 * 24 * 3600000, // fourteen days
                    title: {
                        text: null
                    }
                },
                yAxis: yAxisOptions,

                series: seriesOptions
            });
        }

    });
    </script>
    <script type="text/javascript" src="js/themes/gray.js"></script>

Any examples/code would be greatly appreciated!

Cheers!

  • 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-05-25T19:13:25+00:00Added an answer on May 25, 2026 at 7:13 pm

    If you view the source of the demo page you provided, you can see how it’s done with CSV data. A JSON result is even easier to use.

    Update: The documentation shows you more info on how your data should look.

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

Sidebar

Related Questions

I have a 'price' variable that contains some integer number from a MySQL database.
I have mysql database structure like below: CREATE TABLE test ( id int(11) NOT
I have an MySQL database which contains some data,it interacts with JSP pages,the thing
I have a MySQL database running locally on port 3306. And I would like
I have a MySQL database with a PHP front-end. I would like to implement
I have a mysql database set as utf-8, and csv data set as utf-8,
having a bit of trouble adding some data to a database. I have the
I have a MySQL database with some URLs in it. One URL per row.
I have a MySql database with some sports results in it. I want to
I have some MySQL database server information that needs to be shared between a

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.