drutjkpsr67393592 2013-10-10 11:24
浏览 80

谷歌折线图无法显示每个日期

I was trying to use google linechart for displaying data from my database with corresponding dates on haxis and score on vaxis i achieved that but i want to show dates like 1,2,3,4,5...30 for a month and show weeks if more than 1 month on haxis but its not giving dates like that it gives interval of 7 days for a month but thats not my requirement. i tried using gridlines but not working can anybody help me plz... here is my code

google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawTable);


function drawTable()
{
    var data=new google.visualization.DataTable();
    data.addColumn('date','date');
    data.addColumn('number','score');
    data.addRows([
    <?php 
    $output1=array();
      $output2=array();


    foreach ($gra as $key) {
        $t1=$key;
        $output1[]=$t1;
    } 
    foreach ($dated as $key2) {
        $t2=$key2;
        $output2[]=$t2;
    }
    $combine=array();
    for($i=0;$i<sizeof($output1) && $i<sizeof($output2); $i++)
    {
        $combine[]="[".$output2[$i].",".$output1[$i]."]";
    }
    echo implode(",", $combine);

  ?>

  ]);

  var options={

    title:'Fitness Analysis',
    vAxis:{title:"Fitness Score", viewWindowMode:'explicit',
 viewWindow: {
   max:500,
    min:0
  } },
    hAxis:{title:"Dates",viewWindowMode:'explicit',
    gridlines:{count:30},
  viewWindow: {min: new Date(2013, 8, 1),max: new Date(2013, 9, 1) }}

    };

    var chart = new google.visualization.LineChart(document.getElementById('chartdiv'));
    chart.draw(data, options);  
   }
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 西门子S7-Graph,S7-300,梯形图
    • ¥50 用易语言http 访问不了网页
    • ¥50 safari浏览器fetch提交数据后数据丢失问题
    • ¥15 matlab不知道怎么改,求解答!!
    • ¥15 永磁直线电机的电流环pi调不出来
    • ¥15 用stata实现聚类的代码
    • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
    • ¥20 docker里部署springboot项目,访问不到扬声器
    • ¥15 netty整合springboot之后自动重连失效
    • ¥15 悬赏!微信开发者工具报错,求帮改