(3.1d, SNAPSHOT_v8.3d_2012-06-12/Pro Deployment 2012-06-12)
I'm trying to use your suggestion from July 12th here:
I'm using the TimeSeriesChart code I posted a few days ago. I've change the constructor there so that it always assures a unique "ID" is set:
But I'm still getting this when I try to replace my existing chart:
In my panel's code, I have this layout going on, to create a placeholder within a master VLayout instance:
createTemporaryChart() assigns a FacetChart to the iVar 'd_chart'. Then when I have a new dataset and want to render it, I do this:
Did I misunderstand your guidance earlier? I've successfully used this kind of "placeholder" technique to redraw/repopulate ListGrids with dynamic (client-side-only) field definitions. Will it not work with FacetChart?
At first I thought that each FacetChart instance having the same 'ID' was the problem, but ensuring they would all be different did not help things.
1. Can you please advise about the above?
2. SMALL CODE ENHANCEMENT REQUEST THAT WOULD BE HUGELY HELPFUL HERE: In the error text of the Exception that is generated in this circumstance, could the string "... the component ..." be enhanced with some more descriptive information (the component's ID?) about what the framework thinks has already been created? Clearly in my code above, 'the component' above is a brand new instance of FacetChart that has not yet been rendered.
Thanks.
I'm trying to use your suggestion from July 12th here:
Right now, facets cannot be changed on the fly, however, given a new dataset you can just run the same code to [produce] new instance of FacetChart and destroy() the old.
Code:
's_chartID' is a static int: setID("timeSeriesChart"+(++s_chartID));
Code:
(BaseWidget.java:600) 2012-07-16 18:26:11,276 [ERROR] Uncaught exception java.lang.IllegalStateException: Cannot change configuration property 'facets' to [Lcom.smartgwt.client.widgets.cube.Facet;@510d3297 after the component has been created. at com.smartgwt.client.widgets.BaseWidget.error(BaseWidget.java:600) at com.smartgwt.client.widgets.BaseWidget.error(BaseWidget.java:588) at com.smartgwt.client.widgets.BaseWidget.setAttribute(BaseWidget.java:683) at com.smartgwt.client.widgets.chart.FacetChart.setFacets(FacetChart.java:1871)
Code:
// 'd_mainContent' is a VLayout... d_mainContent.addMember(d_toolbar); d_chartPlaceholder = new VLayout(); d_chartPlaceholder.setWidth100(); d_chartPlaceholder.setHeight100(); d_chartPlaceholder.addMember(createTemporaryChart()); d_mainContent.addMember(d_chartPlaceholder); d_mainContent.addMember(d_footer);
Code:
private void replaceChart(Record[] data) { if (d_chart != null){ d_chartPlaceholder.removeMember(d_chart); d_chart.destroy(); } d_chart = new TimeSeriesChart<Date,XYPoint>(); ... // WHEN I TRY TO REPLACE THE CHART, THIS LINE CAUSES THE EXCEPTION (called from within the TimeSeriesChart class): setFacets(xAxisFacet, new Facet("description", "thing")); d_chartPlaceholder.addMember(d_chart); }
At first I thought that each FacetChart instance having the same 'ID' was the problem, but ensuring they would all be different did not help things.
1. Can you please advise about the above?
2. SMALL CODE ENHANCEMENT REQUEST THAT WOULD BE HUGELY HELPFUL HERE: In the error text of the Exception that is generated in this circumstance, could the string "... the component ..." be enhanced with some more descriptive information (the component's ID?) about what the framework thinks has already been created? Clearly in my code above, 'the component' above is a brand new instance of FacetChart that has not yet been rendered.
Thanks.
Comment