@ Nonnull public IHasJSCode getJSUpdateCode ( @ Nonnull final IJSExpression aJSDataVar ) { final JSPackage ret = new JSPackage ( ) ; // Cleanup old chart ret . invoke ( JSExpr . ref ( getJSChartVar ( ) ) , "destroy" ) ; // Use new chart ret . assign ( JSExpr . ref ( getJSChartVar ( ) ) , new JSDefinedClass ( "Chart" ) . _new ( ) . arg ( JSExpr . ref ( getCanvasID ( ) ) . invoke ( "getContext" ) . arg ( "2d" ) ) . invoke ( m_aChart . getJSMethodName ( ) ) . arg ( aJSDataVar ) . arg ( getJSOptions ( ) ) ) ; return ret ; }
Update the chart with new datasets . This destroys the old chart .