Hi GFMAG,
You need something like:
{"dataSourceUrl": "//docs.google.com/spreadsheet/..etc.&pub=1",
"options": {
"title": "Chart title",
"width": 600,
"height": 400,
"state": '{
"iconType": "VBAR",
"playDuration": 34088
}',
},
"view":{},"chartType":"MotionChart"}
--- Above has most options removed to make it clearer... but it should work
with similar structure and particularly the placement of "state" and the
single quotes.
--- In your editor you'll need a good javascript syntax highlighter to
check all the brackets and braces match up...
Good luck!
Jungle editor
On Friday, February 22, 2013 8:37:39 AM UTC+1, Cetacea wrote:
>
> Hello,
>
> I am new to this and am struggling with the same problem.
>
> I cannot set the initial state string using *CHARTS*. It was easy in *
> Gadgets* [Cut and paste] but they are being deprecated and I need to
> convert a number of gadget based motion chart gadgets to CHARTS.
>
> I don't quite follow/understand EXACTLY what is being changed in the
> script below? Can you please assist? I have blanked out the same bit in the
> code xxxx because I am not sure if I should publicise that or not?
>
>
> - In my initial code, I can see the "state":{}
>
>
> - I am not sure from "Jungle Editor's" response below or ASGALLANT's
> response above, whether I am just making a change to the *"state":{}
> *bit,
> or making changes somewhere else in those lines?
>
> This is my basic code.
>
>
> <script type="text/javascript" src="//
>> ajax.googleapis.com/ajax/static/modules/gviz/1.0/chart.js">
>> {"dataSourceUrl":"//
>> docs.google.com/spreadsheet/tq?key=XXXXXXXXXXXXXXXXXXXXXXXX&transpose=0&headers=1&range=A1%3AF401&gid=1&pub=1
>> ","options":{"vAxes":[{"title":"Left vertical axis
>> title","useFormatFromData":true,"minValue":null,"viewWindow":{"min":null,"max":null},"maxValue":null},{"useFormatFromData":true,"minValue":null,"viewWindow":{"min":null,"max":null},"maxValue":null}],"titleTextStyle":{"fontSize":16},"title":"Chart
>>
>> title","booleanRole":"certainty","height":447,"animation":{"duration":500},"width":649,"hAxis":{"title":"Horizontal
>>
>> axis
>> title","useFormatFromData":true,"minValue":null,"viewWindow":{"min":null,"max":null},"maxValue":null}},
>> "state":{},"view":{"columns":[0,1,{"label":"LGA","properties":{"role":"annotation"},"sourceColumn":2},3,{"label":"Metro/Rural","properties":{"role":"annotation"},"sourceColumn":4},{"label":"Region","properties":{"role":"annotationText"},"sourceColumn":5}]},"chartType":"MotionChart","chartName":"Chart1"}
>>
>> </script>
>
>
>
> This next bit is the code from the advanced menu ATER I have set up the
> starting-state for my CHART:
>
>
>> {"duration":{"multiplier":1,"timeUnit":"Y"},"iconKeySettings":[{"trailStart":"2003","key":{"dim0":"OELLEN"}}],"xZoomedIn":false,"time":"2003","yZoomedDataMin":11.5,"yZoomedIn":false,"xLambda":1,"xAxisOption":"6","showTrails":true,"nonSelectedAlpha":0.4,"yLambda":1,"yZoomedDataMax":58,"colorOption":"2","sizeOption":"7","yAxisOption":"4","iconType":"BUBBLE","playDuration":15000,"orderedByX":false,"orderedByY":false,"xZoomedDataMax":94.4,"uniColorForNonSelected":false,"dimensions":{"iconDimensions":["dim0"]},"xZoomedDataMin":27.2}
>>
>
>
> I understand [I think] that this needs to go BETWEEN the brackets of
> "state":{}
> BUT I don't understand if add single quotes simply around the bit I have
> copied form the ADVANCED window **OR** if I need to change something else
> that effects the "options": bit of the code???
>
> I am sorry if I seem vague, I am just VERY new to this.
>
> Any help appreciated.
>
>
> Cet.
>
> On Tuesday, November 20, 2012 2:30:39 PM UTC+11, asgallant wrote:
>>
>> Yes, you would have '{....}' for the state. The problem is that you have
>> "state" outside the options. Try this instead:
>>
>> <script type="text/javascript" src="
>> http://ajax.googleapis.com/ajax/static/modules/gviz/1.0/chart.js">
>> {"dataSourceUrl":"
>> http://docs.google.com/spreadsheet/tq?key=0AhF_yr_VlAjjdFRCcDRMNUhGakJ3dkxEUFBYcnQ5NkE&transpose=0&headers=0&range=A1%3AD105&gid=0&pub=1","options":{"showChartButtons":true,"titleTextStyle":{"fontSize":16},"vAxes":[{"useFormatFromData":true,"title":"Left
>>
>> vertical axis
>> title","minValue":null,"viewWindowMode":"pretty","viewWindow":{"min":null,"max":null},"maxValue":null},{"useFormatFromData":true,"minValue":null,"viewWindowMode":"pretty","viewWindow":{"min":null,"max":null},"maxValue":null}],"booleanRole":"certainty","title":"Chart
>>
>> title","height":371,"animation":{"duration":500},"width":600,"hAxis":{"useFormatFromData":true,"title":"Horizontal
>>
>> axis
>> title","minValue":null,"viewWindowMode":"pretty","viewWindow":{"min":null,"max":null},"maxValue":null},"state":
>>
>> '{"xZoomedIn":false,"time":"2006","orderedByX":true,"xAxisOption":"2","xLambda":1,"yZoomedIn":false,"yZoomedDataMax":8000,"iconKeySettings":[],"sizeOption":"_UNISIZE","colorOption":"_UNICOLOR","yZoomedDataMin":0,"nonSelectedAlpha":0.4,"playDuration":15000,"xZoomedDataMin":0,"iconType":"VBAR","dimensions":{"iconDimensions":["dim0"]},"orderedByY":false,"yLambda":1,"duration":{"timeUnit":"Y","multiplier":1},"yAxisOption":"2","showTrails":false,"uniColorForNonSelected":false,"xZoomedDataMax":21}'},"view":{},"chartType":"MotionChart","chartName":"Chart
>>
>> 2"}
>> </script>
>>
>> On Monday, November 19, 2012 10:15:09 PM UTC-5, GFMAG-PM wrote:
>>>
>>> Hi Sergey,
>>>
>>> I am not very understanding your meaning. Do you mean put ' ' (single
>>> quotes) around {xxxxx}?
>>>
>>> Because
>>>
>>> {"yZoomedDataMax":8000,"time":"2006","orderedByX":true,"showTrails":false,"uniColorForNonSelected":false,"yLambda":1,"iconKeySettings":[],"playDuration":15000,"yAxisOption":"2","colorOption":"_UNIQUE_COLOR","xAxisOption":"2","yZoomedIn":false,"sizeOption":"_UNISIZE","orderedByY":false,"xLambda":1,"xZoomedIn":false,"duration":{"timeUnit":"Y","multiplier":1},"xZoomedDataMax":21,"nonSelectedAlpha":0.4,"iconType":"VBAR","dimensions":{"iconDimensions":["dim0"]},"xZoomedDataMin":0,"yZoomedDataMin":0}
>>> is I copy from chart advanced, and it say it is a string.
>>>
>>> I also tried put single quotes around {xxxxx}, but still not working.
>>>
>>> Can you just show me a very simple example? Thanks a lot
>>>
>>> Cheers,
>>> GFMAG-PM
>>>
>>
--
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.