Solved

Google Charts - Line

Posted on 2015-02-04
1
152 Views
Last Modified: 2015-02-05
I created a chart google charts,
Is working perfectly, except I would like the values 0-15 for example had another color, how to proceed?

http://www.alexecamila.com.br/monitoramento/grafico.php

<html>
<head>
  <script type="text/javascript" src="https://www.google.com/jsapi"></script>
  <script type="text/javascript">
    google.load('visualization', '1.1', {packages: ['line']});
    google.setOnLoadCallback(drawChart);

    function drawChart() {

      var data = new google.visualization.DataTable();
      data.addColumn('datetime', 'Dia');
      data.addColumn('number', 'Ping');
      data.addRows([
        [new Date(2015, 2 ,3, 0,  5, 0),  0],
		[new Date(2015, 2 ,3, 0, 10, 0),  0],
		[new Date(2015, 2 ,3, 0, 15, 0),  0],
		[new Date(2015, 2 ,3, 0, 20, 0),  0],
		
		[new Date(2015,02,04,00,00),105],
[new Date(2015,02,04,00,05),137],
[new Date(2015,02,04,00,10),106],
[new Date(2015,02,04,00,15),113],
[new Date(2015,02,04,00,20),104],
[new Date(2015,02,04,00,25),104],
[new Date(2015,02,04,00,30),104],
[new Date(2015,02,04,00,35),258],
[new Date(2015,02,04,00,40),104],
[new Date(2015,02,04,00,45),110],
[new Date(2015,02,04,00,50),104],
[new Date(2015,02,04,00,55),105],
[new Date(2015,02,04,01,00),103],
[new Date(2015,02,04,01,05),110],
[new Date(2015,02,04,01,10),103],
[new Date(2015,02,04,01,15),104],
[new Date(2015,02,04,01,20),109],
[new Date(2015,02,04,01,25),103],
[new Date(2015,02,04,01,30),104],
[new Date(2015,02,04,01,35),103],
[new Date(2015,02,04,01,40),103],
[new Date(2015,02,04,01,45),106],
[new Date(2015,02,04,01,50),103],
[new Date(2015,02,04,01,55),103],
[new Date(2015,02,04,02,00),103],
[new Date(2015,02,04,02,05),103],
[new Date(2015,02,04,02,10),103],
[new Date(2015,02,04,02,15),103],
[new Date(2015,02,04,02,20),103],
[new Date(2015,02,04,02,25),488],
[new Date(2015,02,04,02,30),104],
[new Date(2015,02,04,02,35),104],
[new Date(2015,02,04,02,40),103],
[new Date(2015,02,04,02,45),103],
[new Date(2015,02,04,02,50),103],
[new Date(2015,02,04,02,55),103],
[new Date(2015,02,04,03,00),103],
[new Date(2015,02,04,03,05),103],
[new Date(2015,02,04,03,10),103],
[new Date(2015,02,04,03,15),103],
[new Date(2015,02,04,03,20),103],
[new Date(2015,02,04,03,25),103],
[new Date(2015,02,04,03,30),103],
[new Date(2015,02,04,03,35),103],
[new Date(2015,02,04,03,40),103],
[new Date(2015,02,04,03,45),103],
[new Date(2015,02,04,03,50),103],
[new Date(2015,02,04,03,55),104],
[new Date(2015,02,04,04,00),103],
[new Date(2015,02,04,04,05),103],
[new Date(2015,02,04,04,10),103],
[new Date(2015,02,04,04,15),281],
[new Date(2015,02,04,04,20),104],
[new Date(2015,02,04,04,25),103],
[new Date(2015,02,04,04,30),103],
[new Date(2015,02,04,04,35),104],
[new Date(2015,02,04,04,40),104],
[new Date(2015,02,04,04,45),104],
[new Date(2015,02,04,04,50),103],
[new Date(2015,02,04,04,55),103],
[new Date(2015,02,04,05,00),103],
[new Date(2015,02,04,05,05),103],
[new Date(2015,02,04,05,10),103],
[new Date(2015,02,04,05,15),103],
[new Date(2015,02,04,05,20),103],
[new Date(2015,02,04,05,25),103],
[new Date(2015,02,04,05,30),103],
[new Date(2015,02,04,05,35),103],
[new Date(2015,02,04,05,40),103],
[new Date(2015,02,04,05,45),103],
[new Date(2015,02,04,05,50),103],
[new Date(2015,02,04,05,55),103],
[new Date(2015,02,04,06,00),103],
[new Date(2015,02,04,06,05),159],
[new Date(2015,02,04,06,10),103],
[new Date(2015,02,04,06,15),103],
[new Date(2015,02,04,06,20),103],
[new Date(2015,02,04,06,25),103],
[new Date(2015,02,04,06,30),103],
[new Date(2015,02,04,06,35),104],
[new Date(2015,02,04,06,40),104],
[new Date(2015,02,04,06,45),103],
[new Date(2015,02,04,06,50),103],
[new Date(2015,02,04,06,55),103],
[new Date(2015,02,04,07,00),103],
[new Date(2015,02,04,07,05),103],
[new Date(2015,02,04,07,10),103],
[new Date(2015,02,04,07,15),103],
[new Date(2015,02,04,07,20),103],
[new Date(2015,02,04,07,25),103],
[new Date(2015,02,04,07,30),104],
[new Date(2015,02,04,07,35),103],
[new Date(2015,02,04,07,40),104],
[new Date(2015,02,04,07,45),104],
[new Date(2015,02,04,07,50),103],
[new Date(2015,02,04,07,55),254],
[new Date(2015,02,04,08,00),104],
[new Date(2015,02,04,08,05),105],
[new Date(2015,02,04,08,10),105],
[new Date(2015,02,04,08,15),105],
[new Date(2015,02,04,08,20),104],
[new Date(2015,02,04,08,25),103],
[new Date(2015,02,04,08,30),105],
[new Date(2015,02,04,08,35),103],
[new Date(2015,02,04,08,40),103],
[new Date(2015,02,04,08,45),103],
[new Date(2015,02,04,08,50),103],
[new Date(2015,02,04,08,55),104],
[new Date(2015,02,04,09,00),104],
[new Date(2015,02,04,09,05),103],
[new Date(2015,02,04,09,10),104],
[new Date(2015,02,04,09,15),104],
[new Date(2015,02,04,09,20),103],
[new Date(2015,02,04,09,25),103],
[new Date(2015,02,04,09,30),104],
[new Date(2015,02,04,09,35),104],
[new Date(2015,02,04,09,40),103],
[new Date(2015,02,04,09,45),168],
[new Date(2015,02,04,09,50),104],
[new Date(2015,02,04,09,55),106],
[new Date(2015,02,04,10,00),105],
[new Date(2015,02,04,10,05),104],
[new Date(2015,02,04,10,10),106],
[new Date(2015,02,04,10,15),105],
[new Date(2015,02,04,10,20),105],
[new Date(2015,02,04,10,25),104],
[new Date(2015,02,04,10,30),105],
[new Date(2015,02,04,10,35),104],
[new Date(2015,02,04,10,40),104],
[new Date(2015,02,04,10,45),104],
[new Date(2015,02,04,10,50),104],
[new Date(2015,02,04,10,55),104],
[new Date(2015,02,04,11,00),106],
[new Date(2015,02,04,11,05),104],
[new Date(2015,02,04,11,10),105],
[new Date(2015,02,04,11,15),105],
[new Date(2015,02,04,11,20),104],
[new Date(2015,02,04,11,25),107],
[new Date(2015,02,04,11,30),105],
[new Date(2015,02,04,11,35),258],
[new Date(2015,02,04,11,40),104],
[new Date(2015,02,04,11,45),105],
[new Date(2015,02,04,11,50),112],
[new Date(2015,02,04,11,55),105],
[new Date(2015,02,04,12,00),105],
[new Date(2015,02,04,12,05),105],
[new Date(2015,02,04,12,10),105],
[new Date(2015,02,04,12,15),105],
[new Date(2015,02,04,12,20),104],
[new Date(2015,02,04,12,25),104],
[new Date(2015,02,04,12,30),105],
[new Date(2015,02,04,12,35),106],
[new Date(2015,02,04,12,40),105],
[new Date(2015,02,04,12,45),104],
[new Date(2015,02,04,12,50),105],
[new Date(2015,02,04,12,55),104],
[new Date(2015,02,04,13,00),110],
[new Date(2015,02,04,13,05),104],
[new Date(2015,02,04,13,10),105],
[new Date(2015,02,04,13,15),104],
[new Date(2015,02,04,13,20),106],
[new Date(2015,02,04,13,25),256],
[new Date(2015,02,04,13,30),105],
[new Date(2015,02,04,13,35),106],
[new Date(2015,02,04,13,40),110],
[new Date(2015,02,04,13,45),106],
[new Date(2015,02,04,13,50),106],
[new Date(2015,02,04,13,55),107],
[new Date(2015,02,04,14,00),110],
[new Date(2015,02,04,14,05),105],
[new Date(2015,02,04,14,10),126],
[new Date(2015,02,04,14,15),105],
[new Date(2015,02,04,14,20),259],
[new Date(2015,02,04,14,25),109],
[new Date(2015,02,04,14,30),114],
[new Date(2015,02,04,14,35),107],
[new Date(2015,02,04,14,40),106],
[new Date(2015,02,04,14,45),106],
[new Date(2015,02,04,14,50),106],
[new Date(2015,02,04,14,55),104],
[new Date(2015,02,04,15,00),108],
[new Date(2015,02,04,15,05),106],
[new Date(2015,02,04,15,10),132],
[new Date(2015,02,04,15,15),108],
[new Date(2015,02,04,15,20),108],
[new Date(2015,02,04,15,25),108],
[new Date(2015,02,04,15,30),112],
[new Date(2015,02,04,15,35),104],
[new Date(2015,02,04,15,40),106],
[new Date(2015,02,04,15,45),104],
[new Date(2015,02,04,15,50),105],
[new Date(2015,02,04,15,55),112],
[new Date(2015,02,04,16,00),104],
[new Date(2015,02,04,16,05),106],
[new Date(2015,02,04,16,10),272],
[new Date(2015,02,04,16,15),106],
[new Date(2015,02,04,16,20),105],
[new Date(2015,02,04,16,25),110],
[new Date(2015,02,04,16,30),106],
[new Date(2015,02,04,16,35),105],
[new Date(2015,02,04,16,40),104],
[new Date(2015,02,04,16,45),105],
[new Date(2015,02,04,16,50),108],
[new Date(2015,02,04,16,55),107],
[new Date(2015,02,04,17,00),106],
[new Date(2015,02,04,17,05),106],
[new Date(2015,02,04,17,10),105],
[new Date(2015,02,04,17,15),105],
[new Date(2015,02,04,17,20),109],
[new Date(2015,02,04,17,25),106],
[new Date(2015,02,04,17,30),108],
[new Date(2015,02,04,17,35),105],
[new Date(2015,02,04,17,40),104],
[new Date(2015,02,04,17,45),103],
[new Date(2015,02,04,17,50),105],
[new Date(2015,02,04,17,55),104],
[new Date(2015,02,04,17,59),259],
[new Date(2015,02,04,18,00),106],
[new Date(2015,02,04,18,05),103],
[new Date(2015,02,04,18,10),105],
[new Date(2015,02,04,18,15),106],
[new Date(2015,02,04,18,20),106],
[new Date(2015,02,04,18,25),105],
[new Date(2015,02,04,18,30),105],
[new Date(2015,02,04,18,35),105],
[new Date(2015,02,04,18,40),105],
[new Date(2015,02,04,18,45),105],
[new Date(2015,02,04,18,50),104],
[new Date(2015,02,04,18,55),263],
[new Date(2015,02,04,19,00),103],
[new Date(2015,02,04,19,05),105],
[new Date(2015,02,04,19,10),105],
[new Date(2015,02,04,19,15),103],
[new Date(2015,02,04,19,20),101],
[new Date(2015,02,04,19,25),101],
[new Date(2015,02,04,19,30),107],
[new Date(2015,02,04,19,35),104],
[new Date(2015,02,04,19,40),102],
[new Date(2015,02,04,19,45),118],
[new Date(2015,02,04,19,50),102],
[new Date(2015,02,04,19,55),101],
[new Date(2015,02,04,20,00),101],
[new Date(2015,02,04,20,05),101],
[new Date(2015,02,04,20,10),125],
[new Date(2015,02,04,20,15),106],
[new Date(2015,02,04,20,20),107],
[new Date(2015,02,04,20,25),106],
[new Date(2015,02,04,20,30),120],
[new Date(2015,02,04,20,35),101],
[new Date(2015,02,04,20,40),103],
[new Date(2015,02,04,20,45),284],
[new Date(2015,02,04,20,50),102],
[new Date(2015,02,04,20,55),104],
[new Date(2015,02,04,21,00),103],
[new Date(2015,02,04,21,05),103],
[new Date(2015,02,04,21,10),101],
[new Date(2015,02,04,21,15),104],
[new Date(2015,02,04,21,20),101],
[new Date(2015,02,04,21,25),104],
[new Date(2015,02,04,21,30),104],
[new Date(2015,02,04,21,35),102],
[new Date(2015,02,04,21,40),106],
[new Date(2015,02,04,21,45),111],
[new Date(2015,02,04,21,50),101],
[new Date(2015,02,04,21,55),102],
[new Date(2015,02,04,22,00),102],
[new Date(2015,02,04,22,05),129],
[new Date(2015,02,04,22,10),105],
[new Date(2015,02,04,22,15),108],
[new Date(2015,02,04,22,25),123],
[new Date(2015,02,04,22,31),600],
[new Date(2015,02,04,22,31),600],
      ]);

      var options = {
        chart: {
          title: '111',
          subtitle: '2222'
        },
        width: 800,
        height: 400,
        axes: {
          x: {
            0: {side: 'top'}
          }
        }
      };

      var chart = new google.charts.Line(document.getElementById('line_top_x'));
      chart.draw(data, options);
    }
  </script>
</head>
<body>
  <div id="line_top_x"></div>
</body>
</html>

Open in new window

0
Comment
Question by:Waldir-PRG
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 44

Accepted Solution

by:
Rainer Jeschor earned 500 total points
ID: 40590433
Hi,
short answer: this is not possible (right now) with Google line charts.

There might be a workaround by splitting your data having two value columns:
- below 15  and
- over 15
Depending on the value you set the related column, the other to NULL.
Then you have two line series where you can use different colors.
Sample:
http://jsfiddle.net/EE_RainerJ/nr2q11jq/

HTH
Rainer
0

Featured Post

Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
This Micro Tutorial will demonstrate how marketers can use the Mobile Emulation Tool in Chrome Developer Tool. This will let you preview your site on any mobile device.

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question