php - Google chart: I cant label my each (3 column) bar -


right code retrieved data 3 columns of database , display them row in column chart (haxis) , means:-

  1. there 3 bar ( called 3 columns of database)
  2. but want label each of bar (criteria1, criteria 2, criteria3..)
  3. clear example table below..i want retrieve percentage database stored in 3 columns.. criteria labeled manually..

     ________________________ |criteria   |percentage | |-----------------------| |criteria 1 | 64.1      | |-----------------------| |criteria 2 | 11.1      | |-----------------------| |criteria 3 | 21.1      | |-----------------------| 

    thank u much..

edited :getdata.php:

    $table = array();     $table['cols'] = array    (     array('label' => 'criteria', 'type' => 'string'),     array('label' => 'criteria 1', 'type' => 'number'),     array('label' => 'criteria 2', 'type' => 'number'),     array('label' => 'criteria 3', 'type' => 'number')     );     $rows = array();    while($r = mysql_fetch_assoc($sql_query))     {           $temp = array();           $temp[] = array('v' =>"");           $temp[] = array('v' => (float)$r['resultsd']);           $temp[] = array('v' => (float)$r['resultwe']);            $temp[] = array('v' => (float)$r['resulttre']);             $rows[] = array('c' => $temp);     }      $table['rows'] = $rows;     $jsontable = json_encode($table);     echo $jsontable; 

this google visualization code called getdata.php.:

  google.load("visualization", "1", {packages:["corechart"]});    function drawvisualization()    {     var jsondata=null;     var json = $.ajax     ({        url:"getdata.php?id=<?php echo $_get['id'];?>",        datatype: "json",       async: false,        success: (       function(data)        {          jsondata = data;             var data = new google.visualization.datatable(jsondata);                       var options =           {             title: 'sam histogram results',             haxis: {title: " criteria type", titletextstyle: {italic: false,bold: true}},               vaxis: {title: "percentage (%)", titletextstyle: {italic: false, bold: true}},             titletextstyle: {color: 'black', bold:'true'},           }     var chart = new google.visualization.columnchart(document.getelementbyid('visualization')).     draw(data,options);        })     }).responsetext;   }   google.setonloadcallback(drawvisualization); 


Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -