Hey, thanks..
I used data.group(0
Now the problem is the labels on the haxis are not sorted.
I want the labels on haxis as month/year i.e 10/2012, 11/2012, ...
Since the modifier function here returns string , the labels are sorted 
accordingly and not in order.
How can i solve this?
I want grouping based on years and then on months.

on using google.visulization.data.month the months of all the years are 
grouped i.e  if dates are 1/10/2013  2/10/2013  and 5/10/2014  then the 
values for all three dates will be added since month is same. But i want 
months of similar years to be grouped

Here is my code for grouping months. 

var result = google.visualization.data.group(
              data,
              [{ column: 0, modifier: getMonths, type: 'string'}],
              [{ 'column': 1, 'aggregation': google.visualization.data.sum, 
'type': 'number' }, { 'column': 2, 'aggregation': 
google.visualization.data.sum, 'type': 'number'}]
            );


            function getMonths(someDate) {
                var month = someDate.getMonth();
                var year = someDate.getFullYear();

               //return new Date(year, month, 1);
                var string = "" + month + "/" + year;
                return string;

            } 


On Thursday, September 18, 2014 8:49:58 AM UTC+5:30, Andrew Gallant wrote:
>
> You can group your data using the google.visualization.data.group 
> <https://google-developers.appspot.com/chart/interactive/docs/reference#google_visualization_data_group>
>  
> function.  Hook up an event handler on your dropdown that groups your data 
> appropriately (you will want to use a modifier function on your date column 
> to group by year, month, or day) and draws the chart using the grouped data.
>
> Turning series on or off can be done a few different ways, here are a 
> couple of examples I have made up: Show/hide columns by clicking on 
> legend labels <http://jsfiddle.net/asgallant/6gz2Q/> and CategoryFilter 
> as column selector <http://jsfiddle.net/asgallant/WaUu2/>
>
> On Wednesday, September 17, 2014 2:35:27 AM UTC-4, Shivani Kanakhara wrote:
>>
>> Hi ,
>> I want to make a column chart where the data passed is something like 
>> this:
>>
>> Date             Customer1 Customer2
>> 12/2/2014       22.3              33.5
>> 13/2/2014        34.6             33.0
>> 12/3/2014        55.6             34.7
>> 16/3/2014        70.8             56.7
>> 2/05/2015         22.6             33.7
>> 7/05/2015         36.7            44.7
>> 13/8/2015         12.12          12.23
>> 15/8/2015         13.7             44.5
>>
>>
>> I have a dropdown containing values :  1) Year  2)Month and 3) Day
>>  Now what i want is when i select Year the data should group by according 
>> and haxis should contain labels having years 2014,2015
>> When i select months the data should be grouped according to months.
>>
>> How can it be done?
>>
>> Also i want to be able to compare data for multiple customers i.e. show 
>> hide series.
>>
>> Pls help
>>
>

-- 
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/d/optout.

Reply via email to