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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:59:46+00:00 2026-05-26T18:59:46+00:00

I have some data in mysql that I load up in php and draw

  • 0

I have some data in mysql that I load up in php and draw a line chart using the google chart api.

Here is part of the code:

// ... do a sql query , then loop and create a chart ...

while($row=mysql_fetch_array($result))
{
$values[0][]=$row['v1'];
$values[1][]=$row['v2'];
}

$width=600;
$height=500;
$scaleMin=0;
$scaleMax=99;
$chart = new GoogleChart('lc', $width,$height );
$chart->setAutoscale(GoogleChart::AUTOSCALE_OFF);
// ... other google chart setup code
$line = new GoogleChartData($values[0]);
$line->setAutoscale(false);
$line->setScale($scaleMin,$scaleMax);
$line->setLegend('value1');
$chart->addData($line);

$line = new GoogleChartData($values[1]);
$line->setAutoscale(false);
$line->setScale($scaleMin,$scaleMax);
$line->setLegend('value2');
$chart->addData($line);
// ... more lines and chart set up ...

header('Content-Type: image/png');
echo $chart;

So that works fine, except that my “value1” or “v1” data will generally range from a minimum of 10 to a maximum of 90. My “value2” or “v2” data will start off at 0, and over time will increment – potentially to 100,000 or more.

I am trying to figure out how to either set the google chart up so it will display it somehow, OR potentially alter the data in the array so it displays properly.

Currently, it would draw a line, starting a 0, then hour by hour it would climb a little, forming a staircase-like shape. The problem is, it eventually goes past 99, and you have no more line, or similar.

Just looking for some thoughts.

  • 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-26T18:59:47+00:00Added an answer on May 26, 2026 at 6:59 pm

    I ended up adding some logic to my php code to check the previous value in the loop, and set the value to “10” if it increased, “0” if it stayed the same. I can not see the amount it increased (though I am sure mathematically I could calculate that), but in my case all I care about is to know during that time IF it incremented. On my chart, I see a line ranging from 0, jumping to 10 for a few ticks, then going back down to 0.

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

Sidebar

Related Questions

I have a MySQL/Rails app that needs search. Here's some info about the data:
Using mysql 5.1.41 and innodb I'm doing some data import, but can't use load
I have some code which needs to ensure some data is in a mysql
I have some data, yes, data. This data came from a MySQL query and
I have some data. I want to go through that data and change cells
I have some data that I want to store somewhere in my Rails app
I have a number of command line scripts in PHP that use exec() to
Scenario: I load some data into a local MySQL database each day, about 2
I am trying to load some data from a text file into mysql. I
In the google chart api, the data for the chart is set by this

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.