The only thing I see is missing right now is a way to get the charts to 
draw when you click the submit button.  This would do the trick:

$(function () {
    $('#myFormId').submit(function (e) {
        // prevent the default submit behavior
        e.preventDefault();
        drawChart();
    });
});

If your chart is showing up, but is blank, then it sounds like no data is 
getting passed back from the server.  You set the query page to accept data 
via $_POST, so you'll have to set the AJAX call to submit via POST.  Add type: 
'post' to the AJAX options and see if that fixes the problem.

On Sunday, January 13, 2013 12:57:38 PM UTC-5, triple_6 wrote:
>
> and attach :)
>
> W dniu niedziela, 13 stycznia 2013 18:55:01 UTC+1 użytkownik triple_6 
> napisał:
>>
>> ok...
>> i change function to :
>> from_date: $('#from_date').val()
>>
>> now i have charts witch no data.
>>
>> also i change this select to this:
>>
>> echo "<option 
>>> value='".$row["from_date"]."'".($row["from_date"]==$_REQUEST["from_date"] ? 
>>> " selected" : "").">".$row["from_date"]."</option>";
>>>
>>
>> less coding the same result :)
>> i also add GROUP BY from_date - i miss that.
>>
>> yet still nothing :( i change date and submit form - reload page, date 
>> is set but charts is empty.
>>
>> In attach new files.
>> have any ideas?
>>
>> W dniu niedziela, 13 stycznia 2013 17:25:27 UTC+1 użytkownik asgallant 
>> napisał:
>>>
>>> You are close.  The select tag needs the id "from_date" if you want to 
>>> use that selector in the jQuery:
>>>
>>> <select name="from_date" id="from_date">
>>>
>>> Also, one of the options in the list needs to be set as the default 
>>> option.  Perhaps this would work for you:
>>>
>>> $first = true;
>>> while ($row = mysql_fetch_array($result)){
>>> $default = ($first) ? 'selected="selected"' : '';
>>> $first = false;
>>> echo "<option value=\"{$row['from_date']}\" $default 
>>> >{$row['from_date']}</option>";
>>> }
>>>
>>> which sets the first result returned in the query as the default.
>>>
>>> Give that a try and see how it does for you.
>>>
>>> On Sunday, January 13, 2013 3:51:12 AM UTC-5, triple_6 wrote:
>>>>
>>>> in attach new files.
>>>> Can you see is this is correct:)
>>>> Many many thanks :)
>>>>
>>>> W dniu niedziela, 13 stycznia 2013 04:24:53 UTC+1 użytkownik asgallant 
>>>> napisał:
>>>>>
>>>>> You're not sending the "from_date" in the AJAX call.  You need to add 
>>>>> that, like this:
>>>>>
>>>>> var jsonData =$.ajax({
>>>>> url: "goo2.php",
>>>>> data: {
>>>>> // pick anything you want here, or grab from the form
>>>>> // the form's date select doesn't have the values set
>>>>> // and doesn't have a default selection, so setting that on load 
>>>>> wouldn't work as is
>>>>> from_date: '2011-01-01'
>>>>> },
>>>>> dataType:"json",
>>>>> async: false
>>>>> }).responseText;
>>>>>
>>>>> If you want to change the chart based on the user's selection, then 
>>>>> you will have to hook an "onchange" event listener for the select 
>>>>> dropdown 
>>>>> to pull the newly selected value and requery.
>>>>> On Saturday, January 12, 2013 7:28:16 PM UTC-5, triple_6 wrote:
>>>>>>
>>>>>> Hi,
>>>>>> i have still problem with post data...
>>>>>> in attach my files.
>>>>>> when i set "date from" and click submit, files "goo2.php" generates 
>>>>>> correct array, but this array is not import back to "index.php".
>>>>>> Please could somebody help me? :(
>>>>>>
>>>>>>
>>>>>> W dniu czwartek, 13 grudnia 2012 08:22:00 UTC+1 użytkownik 
>>>>>> Chrystopher Medina napisał:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> i didn´t understand very well ... excuse me. but 
>>>>>>>  this is my new json array : 
>>>>>>>
>>>>>>> {"cols":[{"label":"Type","type":"string"},{"label":"Count","type":"number"},{"label":"Aspecto","type":"number"}],"rows":[{"c":[{"v":"excelent"},{"v":1}]},{"c":[{"v":"good"},{"v":2}]},{"c":[{"v":"fair"},{"v":1}]},{"c":[{"v":"poor"},{"v":1}]},{"c":[{"v":"word
>>>>>>>  
>>>>>>> of mouth recomendation"},{"v":3}]},{"c":[{"v":"magazine 
>>>>>>> advertisement"},{"v":1}]},{"c":[{"v":"roadside 
>>>>>>> advertisement"},{"v":1}]},{"c":[{"v":"google"},{"v":3}]}]}.
>>>>>>>
>>>>>>> this is my php file:
>>>>>>>
>>>>>>> <?php 
>>>>>>> $var1="$_POST[fecha1]";
>>>>>>>
>>>>>>> $var2= "$_POST[fecha2]";
>>>>>>>
>>>>>>> $server="localhost";
>>>>>>> $username="root";
>>>>>>> $password="chrystopher";
>>>>>>> $databasename="encuestasavandaro";
>>>>>>>
>>>>>>> $con = mysql_connect($server,$username,$password) or die ('Error 
>>>>>>> connecting to server');
>>>>>>> mysql_select_db($databasename,$con);
>>>>>>>
>>>>>>> $query = "SELECT b.id_respuesta , COUNT(b.id_respuesta) AS cnt, 
>>>>>>> b.id_aspecto
>>>>>>> FROM huesped a, rompe_encuesta b
>>>>>>> WHERE
>>>>>>> b.id_huesped = a.id_huesped AND
>>>>>>> ((b.id_aspecto = 1 AND b.id_respuesta >= 8 AND b.id_respuesta <= 11) 
>>>>>>> OR 
>>>>>>> (b.id_aspecto = 2 AND b.id_respuesta >= 1 AND b.id_respuesta <= 4))
>>>>>>> AND
>>>>>>> a.fecha BETWEEN '2012-12-01' AND '2012-12-12'
>>>>>>> GROUP BY b.id_respuesta;";
>>>>>>>
>>>>>>>
>>>>>>> $table = array();
>>>>>>>
>>>>>>> $table['cols']=array(
>>>>>>> array('label' => 'Type' , 'type' => 'string'),
>>>>>>>  array('label' => 'Count' , 'type' => 'number'),
>>>>>>>         array('label' => 'Aspecto', 'type' => 'number')
>>>>>>> );
>>>>>>>
>>>>>>> $rows = array();
>>>>>>>  if (!mysql_query($query,$con))
>>>>>>>   {
>>>>>>>   die('Error: ' . mysql_error());
>>>>>>>   }else{
>>>>>>>       
>>>>>>>       $sqlquery= mysql_query($query);
>>>>>>> while($r = mysql_fetch_assoc($sqlquery)){
>>>>>>>     $temp = array();
>>>>>>> // using (int) $variable typecasts the variable as an integer, 
>>>>>>> usefull when the SQL is returning numbers as strings
>>>>>>>    
>>>>>>>     switch ((int) $r['id_respuesta']) {
>>>>>>>                 
>>>>>>>                 case 1:
>>>>>>>                         $type='excelent';
>>>>>>>                         break;
>>>>>>>                 case 2:
>>>>>>>                         $type='good';
>>>>>>>                         break;;
>>>>>>>                 case 3:
>>>>>>>                         $type='fair';
>>>>>>>                         break;
>>>>>>>                 case 4:
>>>>>>>                         $type='poor';
>>>>>>>                         break;
>>>>>>>         
>>>>>>> case 8:
>>>>>>>  $type = 'word of mouth recomendation';
>>>>>>> break;
>>>>>>>  case 9:
>>>>>>> $type = 'magazine advertisement';
>>>>>>>  break;
>>>>>>> case 10:
>>>>>>> $type = 'roadside advertisement';
>>>>>>>  break;
>>>>>>>                     case 11:
>>>>>>> $type = 'google';
>>>>>>>  break;
>>>>>>>                     default:
>>>>>>> die('{"error":"Error in SQL query: unknown \'id_respuesta\'"}');
>>>>>>>  }
>>>>>>>
>>>>>>>     $temp[] = array('v' => $type);
>>>>>>>     $temp[] = array('v' => (int) $r['cnt']);
>>>>>>>     $rows[] = array('c' => $temp);
>>>>>>> }
>>>>>>>   }
>>>>>>> $table['rows'] = $rows;
>>>>>>>
>>>>>>> $jsonTable = json_encode($table);
>>>>>>> echo $jsonTable;
>>>>>>>
>>>>>>> ?>
>>>>>>>
>>>>>>>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-visualization-api/-/nffRTuJ4kFEJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-visualization-api?hl=en.

Reply via email to