How else can you build such a graph without using these strange NULLs in an array? Here is an example

google.charts.load('current', {'packages':['corechart']}); google.charts.setOnLoadCallback(drawChart); function drawChart() { var data = google.visualization.arrayToDataTable([ ['дата', 'онлайн', 'офлайн'], ['09.05.16', 55, null], ['10.05.16', 44, null], ['11.05.16', 7, null], ['12.05.16', 56, null], ['13.05.16', 45, null], ['14.05.16', 45, null], ['15.05.16', 60, 60], ['16.05.16', 60, 60], ['17.05.16', 34, null], ['18.05.16', 43, null], ['19.05.16', 60, 60], ['20.05.16', 60, 60], ['21.05.16', 55, null] ]); var options = { title: 'Как можно еще построить такой график не используя в массиве эти странные NULL?', hAxis: {title: 'Дата', titleTextStyle: {color: '#333'}}, vAxis: {minValue: 0} }; var chart = new google.visualization.AreaChart(document.getElementById('chart_div')); chart.draw(data, options); } 

Closed due to the fact that the essence of the question is not clear to the participants of MasterAlex , cheops , Streletz , aleksandr barakin , user194374 12 Jun '16 at 6:02 .

Try to write more detailed questions. To get an answer, explain what exactly you see the problem, how to reproduce it, what you want to get as a result, etc. Give an example that clearly demonstrates the problem. If the question can be reformulated according to the rules set out in the certificate , edit it .

  • are they weird? - Pavel
  • ['15.05.16', null], ['16.05.16', null], ['17.05.16', 34], ['18.05.16', 43], ['19.05.16', null], ['20.05.16', null], ['21.05.16', 55] I would like to send something like this: ['15.05.16', null], ['16.05.16', null], ['17.05.16', 34], ['18.05.16', 43], ['19.05.16', null], ['20.05.16', null], ['21.05.16', 55] - wwwplaton
  • @wwwplaton, a pledge of excellent understanding is an explanation in simple words of what you want to get, you only have an example of some code, without understanding the essence of the question. - MasterAlex
  • @MasterAlex look at the answer below, there is just a line. If we pass NULL in the data, there is no line, and I need it in red there - wwwplaton
  • @wwwplaton, well, if the answer below is exactly what you wanted, then you can explain nothing to the others :) - MasterAlex

1 answer 1

Here's an example from google charts I think this is what you need.

  google.charts.load('current', {packages: ['corechart', 'line']}); google.charts.setOnLoadCallback(drawBackgroundColor); function drawBackgroundColor() { var data = new google.visualization.DataTable(); data.addColumn('number', 'X'); data.addColumn('number', 'Dogs'); data.addRows([ [0, 0], [1, 10], [2, 23], [3, 17], [4, 18], [5, 9], [6, 11], [7, 27], [8, 33], [9, 40], [10, 32], [11, 35], [12, 30], [13, 40], [14, 42], [15, 47], [16, 44], [17, 48], [18, 52], [19, 54], [20, 42], [21, 55], [22, 56], [23, 57], [24, 60], [25, 50], [26, 52], [27, 51], [28, 49], [29, 53], [30, 55], [31, 60], [32, 61], [33, 59], [34, 62], [35, 65], [36, 62], [37, 58], [38, 55], [39, 61], [40, 64], [41, 65], [42, 63], [43, 66], [44, 67], [45, 69], [46, 69], [47, 70], [48, 72], [49, 68], [50, 66], [51, 65], [52, 67], [53, 70], [54, 71], [55, 72], [56, 73], [57, 75], [58, 70], [59, 68], [60, 64], [61, 60], [62, 65], [63, 67], [64, 68], [65, 69], [66, 70], [67, 72], [68, 75], [69, 80] ]); var options = { hAxis: { title: 'Time' }, vAxis: { title: 'Popularity' }, backgroundColor: '#f1f8e9' }; var chart = new google.visualization.LineChart(document.getElementById('chart_div')); chart.draw(data, options); } 
  • If null then how to highlight the line? - wwwplaton