java - Serialization of Chart configuration in Vaadin -
i utilize vaadin 7. want save chart configuration , restore later. found interesting thing in com.vaadin.addon.charts.model.configuration can serialize configuration json object.
code :
chart.getconfiguration().tostring(); result:
{ "type": "column" }, "title": { "text": "chart" }, "xaxis": { "categories": [ "f", "e" ], "axisindex": 0 }, "yaxis": { "min": 0, "title": { "text": "quantity" }, "axisindex": 0 }, "tooltip": { "_fn_formatter": "this.series.name +\u0027: \u0027+ this.y +\u0027 (\u0027+ math.round(this.percentage) +\u0027%)\u0027" }, "plotoptions": { "column": { "stacking": "normal" } }, "series": [ { "data": [ 1, 2 ], "name": "d", "visible": true } ], "exporting": { "enabled": false } } what want build configuration json object. there way ?
found it, pretty simple :
chart chart = new chart(); //json string containing json object chart.setjsonconfig(json); //you'll have draw chart update if needed //chart.drawchart(); java json serialization charts vaadin
No comments:
Post a Comment