google visualization - Publish motion chart: set initial state -
after creating motion chart in spreadsheet , selecting 'publish', following code, pasted html page on server produces working chart (i removed spreadsheet url):
<script type="text/javascript" src="//ajax.googleapis.com/ajax/static/modules/gviz/1.0/chart.js"> {"datasourceurl":"//docs.google.com/spreadsheet/tq?key=[mysheet]&transpose=0&headers=1&range=a1%3ac57&gid=0&pub=1","options":{"showchartbuttons":true,"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":643,"animation":{"duration":500},"width":1468,"showsidepanel":true,"haxis":{"title":"horizontal axis title","useformatfromdata":true,"minvalue":null,"viewwindow":{"min":null,"max":null},"maxvalue":null}},"state":{},"view":{},"isdefaultvisualization":true,"charttype":"motionchart","chartname":"chart 1"} </script>
however chart not maintain state changes have made in chart's display: color, size, lin/log, etc.
i can acquire current state settings string via advanced dialog:
{"ylambda":0,"xzoomeddatamax":381835,"coloroption":"_unique_color","xzoomedin":false,"showtrails":false,"yzoomedin":false,"playduration":15000,"nonselectedalpha":0.4,"xlambda":0,"yaxisoption":"2","yzoomeddatamax":381835,"yzoomeddatamin":6213,"icontype":"bubble","time":"2000","orderedbyx":false,"iconkeysettings":[{"key":{"dim0":"metric1"}},{"key":{"dim0":"metric2"}},{"key":{"dim0":"metric3"}},{"key":{"dim0":"metric4"}}],"dimensions":{"icondimensions":["dim0"]},"orderedbyy":false,"duration":{"multiplier":1,"timeunit":"y"},"sizeoption":"2","unicolorfornonselected":false,"xaxisoption":"2","xzoomeddatamin":6213}
but placing them in "state":{} parameter in html file has no effect. i've tried placing state string in various other locations, again without effect. put state string display desired initial state?
you add them "state" option string, not object:
state: '{"ylambda":0,"xzoomeddatamax":381835,"coloroption":"_unique_color","xzoomedin":false,"showtrails":false,"yzoomedin":false,"playduration":15000,"nonselectedalpha":0.4,"xlambda":0,"yaxisoption":"2","yzoomeddatamax":381835,"yzoomeddatamin":6213,"icontype":"bubble","time":"2000","orderedbyx":false,"iconkeysettings":[{"key":{"dim0":"metric1"}},{"key":{"dim0":"metric2"}},{"key":{"dim0":"metric3"}},{"key":{"dim0":"metric4"}}],"dimensions":{"icondimensions":["dim0"]},"orderedbyy":false,"duration":{"multiplier":1,"timeunit":"y"},"sizeoption":"2","unicolorfornonselected":false,"xaxisoption":"2","xzoomeddatamin":6213}'
and state option (that is, parameter of options
), not state parameter, motioncharts legacy visualization predates modern structure. gets entered this:
options: {/* list of options */, state: 'state string'}
not this:
options: {/* list of options */}, state: 'state string'
Comments
Post a Comment