Solved

Google Charts - Line

Posted on 2015-02-04
1
145 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
1 Comment
 
LVL 44

Accepted Solution

by:
Rainer Jeschor earned 500 total points
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
HTML page and JavaScript 2 49
jQuery animation faster 1 16
Login area of a page 4 19
addressing a specific html page 9 19
Google is more than just a search engine. Over the years the company has developed a wide range of online services that are readily available to all users. This article highlights how one can use Google services for simple project management.
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
This Micro Tutorial  demonstrates whether your site uses one subdomain or multiple subdomains, how to create full URLs from Google Analytics content reports. This procedure is called concatenation and can also be done with the CONCATENTATE function.…
This Micro Tutorial demonstrates how to create custom reports and the secrets of determine the metrics and dimensions for your data that works best with your needs.

743 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now