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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T14:44:07+00:00 2026-06-04T14:44:07+00:00

Below is my simple graph on high charts. Everything appears fine but only problem

  • 0

Below is my simple graph on high charts. Everything appears fine but only problem I have now my data is just two 2012-05-26 01:00:00, 200 and 2012-05-26 02:00:00,300. The y-axis appears fine. But on the x-axis it appear the time as start at 17:00 and ends at 18:00 and it does not even show the date even. What could be the problem?

<?php
    define('DB_HOST', '*******');
    define('DB_USER', 'user1');
    define('DB_PASSWORD', 'test1');
    define('DB_DATABASE', 'db1');

 $dbcnx = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
 mysql_select_db('db1');

$sql = "select unix_timestamp(datetime1) as datetime1, value1 from data";
$result = mysql_query($sql,$dbcnx);
$data = array();
while ($row = mysql_fetch_array($result)) {
   //extract $row;
   //$datetime1 = $row['dateTime1']*1000;
   $datetime = $row['datetime1']*1000; 
   //echo $datetime;
   echo $row['value1'];
   $val  = $row['value1'];
   // convert from Unix timestamp to JavaScript time
   $data[] = "[$datetime, $val]";
}
?>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <title>Highcharts Example</title>

        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
        <script type="text/javascript">
$(function () {
    $(document).ready(function() {
      //alert("TS");
      var chart = new Highcharts.Chart({
      chart: {
         renderTo: 'container',
                type: 'line',
                marginRight: 130,
                marginBottom: 25

      },

      series: 
        [{
         data: [<?php echo join($data, ',') ?>]
      }],
      xAxis: { type: 'datetime'}

   });
  });

});
        </script>
    </head>
    <body>
<script src="js/highcharts.js"></script>
<script src="js/modules/exporting.js"></script>

<div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div>

    </body>
</html>
  • 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-04T14:44:08+00:00Added an answer on June 4, 2026 at 2:44 pm

    I have no idea what data you are passing the highchart. By the sounds of it you are only passing it two data points. Did you verify that the query is pulling the data you want? If so, can you post here the data that should be in the highchart? Also, can you post here the highcharts that is generated in the view source of the webpage?

    As far as the xaxis labels, since they are of datetime format, then the chart will render them the best way it sees fit. If you don’t like the way they are rendered, you can control the datetime formats of the chart using dateTimeLabelFormats. You can also control the interval of the dates shown using tickInterval.

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

Sidebar

Related Questions

I have a fairly simple data.frame dput(x), below: x <- structure(list(variable = c(a, b,
Below just a simple race between 2 button in 2 threads, and this will
Consider the simple example below of implementing a method in an Enum. One problem
I have a simple code below: import java.util.ArrayList; public class BoidList extends ArrayList {
The below code is very simple. I have a jQuery autocomplete bound to an
below i have a code that runs in most of my simple programs ..
I have made a very simple Pie Graph generator using Javascript & SVG graphics.
I have a directed cyclic graph with values at edges but no values at
I have the below simple program using boost threads, what would be the changes
I use Jung to draw graphs. Below is a simple graph with tree layout

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.