私は多くのGoogleグラフを持っています。私は毎週Googleグラフを持っています。複数のGoogleグラフを1つのグラフに表示
たとえば、 私は2017年5月15日 [[date,'real_likes_this_week_till_now','expected_this_weektotal_likes'],['2017/5/8',0,42],['2017/5/9',3,39],['2017/5/10',10,40],['2017/5/11',16,41],['2017/5/12',20,40],['2017/5/13',31,43],['2017/5/14',35,41],['2017/5/15',43,43]]
[[date,'real_likes_this_week_till_now','expected_this_week_total_likes'],['2017/5/1',0,35]['2017/5/2',3,34],['2017/5/3',7,36],['2017/5/4',10,38]['2017/5/5',16,36],['2017/5/6',31,40]['2017/5/7',35,40]['2017/5/8',40,40]]
2017年5月8日までの週2017年5月1日のデータ
を持っています
私はこの
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
// Load google charts
google.charts.load('current', {'packages':['corechart','line']});
google.charts.setOnLoadCallback(drawweek1);
// Draw the chart and set the chart values
function drawweek1() {
var data = google.visualization.arrayToDataTable(
[['date','real_likes_this_week_till_now','expected_this_week_total_likes'],['2017/5/1',0,35],['2017/5/2',3,34],['2017/5/3',7,36],['2017/5/4',10,38],['2017/5/5',16,36],['2017/5/6',31,40],['2017/5/7',35,40],['2017/5/8',40,40]]
);
// Optional; add a title and set the width and height of the chart
var options = {'title':'week1', 'width':550, 'height':400,'pointSize': 10,'hAxis':{
'slantedText': true,
'slantedTextAngle':30},'vAxis':{}};
// Display the chart inside the <div> element with id="differnt"
$elem = document.getElementById('chart_week1');
if($elem === null){return;}
var chart = new google.visualization.LineChart(document.getElementById('chart_week1'));
chart.draw(data, options);
}
google.charts.setOnLoadCallback(drawweek2);
// Draw the chart and set the chart values
function drawweek2() {
var data = google.visualization.arrayToDataTable(
[['date','real_likes_this_week_till_now','expected_this_week_total_likes'],['2017/5/8',0,42],['2017/5/9',3,39],['2017/5/10',10,40],['2017/5/11',16,41],['2017/5/12',20,40],['2017/5/13',31,43],['2017/5/14',35,41],['2017/5/15',43,43]]
);
// Optional; add a title and set the width and height of the chart
var options = {'title':'week2', 'width':550, 'height':400,'pointSize': 10,'hAxis':{
'slantedText': true,
'slantedTextAngle':30},'vAxis':{}};
// Display the chart inside the <div> element with id="differnt"
$elem = document.getElementById('chart_week2');
if($elem === null){return;}
var chart = new google.visualization.LineChart(document.getElementById('chart_week2'));
chart.draw(data, options);
}
</script>
<div id="chart_week1"></div>
<div id="chart_week2"></div>
私はこのように多くのグラフを持っています。 1つのグラフにそれらを表示する方法はありますか?まだ1週間のデータを表示する必要がありますが、ユーザーは先週または翌週に変更できるはずです
ここでの主な問題は毎週末です1つの日付には2つの値セットがあります。たとえば、2017/5/8には[2017/5/8,40,40]と['2017/5/8'、0,42]があります。他の賢明な私は1つの配列にすべてのデータを組み合わせることができます。ここで説明するDATAVIEWの方法を使用してくださいShow only seven days of data on google chart WhiteHatで。
に便利かもしれませんが、私は2017年5月8' 日のことを意味私たちは、2組の値を持っている... '[ '2017/5/8 '、40,40]と[' 2017/5/8 '、0,40] 'のように配列されていて、' '[date、' real_likes_this_week_till_now '、' expected_this_week_total_likes ']、[' 2017 /5/1'0,35] ...... ['2017/5/7,35,40]、['2017/5/8,40,40]、['2017/5/8 '、0,40]、[' 2017/5/9 '、x、x] .....]' – beginner
日がありません。毎日同じパターン@WhiteHat – beginner