thanks a lot Sergey, yes exactly, i needed something like this but it
doesn't work very well so i used this function, it works very well ....
calc: function (dt, row) {
var date = dt.getValue(row, 2);
var formatter = new
google.visualization.DateFormat({pattern:"dd/MM/yyyy
HH:mm"});
return formatter.formatValue(date);
//return date.getDate() + '/' + (date.getMonth()+1) + '/' +
(date.getYear()+1900)+ ' ' + date.getHour() ;
//calc: function (dt, row) {
// return dt.getValue(row, 2).toString();
//return dt.getValue(row, 2);
}
On Tuesday, September 17, 2013 4:15:53 PM UTC+2, Sergey wrote:
>
> Yes, I understand that you have to convert it to a string, but you should
> do it in a way that is appropriate to you. Using .toString() directly
> formats it in the JavaScript way. You may want to do something like
> function (dt, row) {
> var date = dt.getValue(row, 2);
> return date.getDate() + '/' + (date.getMonth() + 1) + '/' +
> date.getYear();
> }
>
> - Sergey
>
>
> On Tue, Sep 17, 2013 at 10:12 AM, khamosh <[email protected]<javascript:>
> > wrote:
>
>> I must to do it, because the type of column 2 , it must be string if not
>> I have this error : Type mismatch. Value Mon Sep 09 2013 15:04:53
>> GMT+0200 (CEST) does not match type string
>>
>>
>> On Tuesday, September 17, 2013 3:53:11 PM UTC+2, Sergey wrote:
>>
>>> Hi, you're seeing this because you're formatting the dates manually
>>> yourself, when you calculate your column. Instead of doing return
>>> dt.getValue(row, 2).toString(), you may want to do something more
>>> complex there.
>>>
>>> - Sergey
>>>
>>>
>>> On Tue, Sep 17, 2013 at 8:18 AM, khamosh <[email protected]> wrote:
>>>
>>>> this is my code ...
>>>>
>>>> in this part i get the query on my dataTable :
>>>>
>>>> function createQueryCityName(strUser) {
>>>> var query = new google.visualization.Query ("
>>>> http://api.XXXX.com/XXXX/**datasource?table=<http://api.XXXX.com/XXXX/datasource?table=>
>>>> "+strUser+"_**physics");
>>>> console.log(query, typeof (query));
>>>> return query;
>>>> }
>>>> ....
>>>> and in this part i send it for drawing :
>>>>
>>>> function drawDashboard() {
>>>> //console.log(zoneView.**toDataTable().toJSON());
>>>> // Create a dashboard.
>>>> var dashboard = new google.visualization.**Dashboard(document.**
>>>> getElementById('dashboard_div'**));
>>>>
>>>> // Create a range slider, passing some options
>>>> var donutRangeSlider = new google.visualization.**ControlWrapper({
>>>> "controlType": "ChartRangeFilter",
>>>> "containerId": "filter_div",
>>>> "options": {
>>>> "filterColumnLabel": "physics_reportings_timestamp"**,
>>>> ui : {
>>>> chartType: "ComboChart",
>>>> chartOptions: {
>>>> chartArea: {
>>>> //width: '85%' // this should match
>>>> chartArea.width of the chart
>>>> height : 40,
>>>> width : 400,
>>>> }
>>>> },
>>>> chartView: {
>>>> columns: [2, 3, 4]
>>>> },
>>>> }
>>>> }
>>>> });
>>>>
>>>> // Create a Combochart, passing some options
>>>> var ComboChart = new google.visualization.**ChartWrapper({
>>>> "chartType": "ComboChart",
>>>> "containerId": "chart_div",
>>>> options: {
>>>> chartArea: {
>>>> // percents work fine in the chartArea
>>>> height : 200,
>>>> width: 400, // this should match chartArea.width of the control
>>>>
>>>> },
>>>> hAxis: {title: "Month"},
>>>> seriesType: "line",
>>>>
>>>> /* legend: {
>>>> position: 'right'
>>>> },*/
>>>> series: {
>>>> 0: {
>>>> // make this a "line" series
>>>> type: "line",
>>>> color: "#FC0519",
>>>> // use the left axis
>>>> targetAxisIndex: 0
>>>> },
>>>> 1: {
>>>> // make this a "line" series
>>>> type: "line",
>>>> color: "#4E0AFA",
>>>> // use the left axis
>>>> targetAxisIndex: 0
>>>> },
>>>> 2: {
>>>> // make this a "line" series
>>>> type: "line",
>>>> color: "#010101",
>>>> // use the right axis
>>>> targetAxisIndex: 1
>>>> },
>>>> 3: {
>>>> type: "steppedArea",
>>>> lineWidth: 0,
>>>> color: "#00FF00",
>>>> enableInteractivity: false,
>>>> targetAxisIndex: 2
>>>> },
>>>> 4: {
>>>> type: "steppedArea",
>>>> lineWidth: 0,
>>>> color: "#FFFF00",
>>>> enableInteractivity: false,
>>>> targetAxisIndex: 2
>>>> }
>>>> },
>>>> vAxes: {
>>>> // assign options for the left axis
>>>> 0: {
>>>> title: "Temperature(Deg C)"
>>>> },
>>>> // assign options for the right axis
>>>> 1: {
>>>> title: "Power(kW)"
>>>> },
>>>> 2: {
>>>> // hide this axis froim view
>>>> textPosition: "none",
>>>> gridlines: {
>>>> count: 0
>>>> }
>>>> }
>>>> }
>>>> },
>>>> view: {
>>>> columns: [
>>>> {
>>>> //transform the numbers into strings, so the
>>>> steppedArea series will work
>>>> type: "string",
>>>> label: zoneView.getColumnLabel(2),
>>>> calc: function (dt, row) {
>>>> return dt.getValue(row, 2).toString();
>>>> }
>>>> },
>>>> 3, 4, 5, 6, 7]
>>>> }
>>>> });
>>>>
>>>> dashboard.bind(**donutRangeSlider, ComboChart);
>>>>
>>>> dashboard.draw(zoneView);
>>>>
>>>>
>>>> }
>>>>
>>>> and this is my JSON :
>>>>
>>>> [{"id":"ecoadmin_building_**name","label":"ecoadmin_**building_name","type":"string"**,"pattern":""},{"id":"**ecoadmin_zone_name","label":"**ecoadmin_zone_name","type":"**string","pattern":""},{"id":"**physics_reportings_timestamp",**"label":"physics_reportings_**timestamp","type":"datetime","**pattern":""},{"id":"physics_**reportings_outdoor","label":"**physics_reportings_outdoor","**type":"number","pattern":""},{**"id":"physics_reportings_**indoor","label":"physics_**reportings_indoor","type":"**number","pattern":""},{"id":"**physics_reportings_energy","**label":"physics_reportings_**energy","type":"number","**pattern":""},{"id":"physics_**reportings_presence","label":"**physics_reportings_presence","**type":"number","pattern":""},{**"id":"physics_reportings_**daylight","label":"physics_**reportings_daylight","type":"**number","pattern":""}],"rows":**[{"c":[{"v":"XXXX"},{"v":"**XXXX"},{"v":new
>>>>
>>>> Date(2012,11,8,0,4,53)},{"v":**3.6},{"v":13.2},{"v":0.0},{"v"**:0.0},{"v":0.0}]}.............**.....................
>>>>
>>>>
>>>>
>>>> On Tuesday, September 17, 2013 2:01:17 PM UTC+2, khamosh wrote:
>>>>>
>>>>>
>>>>>
>>>>> On Tuesday, September 17, 2013 9:18:45 AM UTC+2, khamosh wrote:
>>>>>>
>>>>>> hello every body, i have a problem i have a ComboChart that get the
>>>>>> data from my JSON but in my JSON the format of my date is like this "
>>>>>> Fri
>>>>>> Aug 23 2013 05:04:53 GMT+0200 (Romance Standard Time) " and i don't want
>>>>>> to
>>>>>> see all of this in my chart just i want to see " Aug 23 2013 05:04:53 "
>>>>>> how can i do it?
>>>>>>
>>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Google Visualization API" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to google-visualization-api+**[email protected].
>>>> To post to this group, send email to google-visua...@**googlegroups.com
>>>> .
>>>>
>>>> Visit this group at http://groups.google.com/**
>>>> group/google-visualization-api<http://groups.google.com/group/google-visualization-api>
>>>> **.
>>>> For more options, visit
>>>> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>
>>>> .
>>>>
>>>
>>> --
>> You received this message because you are subscribed to the Google Groups
>> "Google Visualization API" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected]<javascript:>
>> .
>> To post to this group, send email to
>> [email protected]<javascript:>
>> .
>> Visit this group at
>> http://groups.google.com/group/google-visualization-api.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/groups/opt_out.