-
FEATURED COMPONENTS
First time here? Check out the FAQ!
I want to have a grid which will be showing charts (charts are to be added to the model dynamically) and I want charts to keep refresh (Precisely I want to collect all the data and then refresh all charts in one go).
If I use rowrenderer and creates charts in there and everytime model is changed, it is creating the charts again(Right?). Is there anything built in.
MyRowRenderer extends RowRenderer { @Override public void render(Row row, Object data) throws Exception { List<MyModel> modelList = (List<MyModel>)data; for(MyModel myModel : modelList) { Panel panel = new Panel(); panel.setTitle(myModel.getTitle()); Panelchildren panelChild = new Panelchildren(); panelChild.setParent(panel); Listbox lb = new Listbox(); Listitem item1 = new Listitem(); Listcell cell1 = new Listcell("Total Memory"); Listcell cell2 = new Listcell(myModel.getTotalMemory()); cell1.setParent(item1); cell2.setParent(item1); Chart chart = new Chart(); chart.setType("line"); chart.setHeight("100px"); chart.setWidth("190px"); XYModel model = new SimpleXYModel(); model.addValue("tm", myModel.getTimeStamp(), myModel.getCurrentValue()); chart.setModel(model); chart.setParent(panelChild); panel.setParent(row); } } }
class MyModel { long timestamp; long currentValue; String title; //getter/setter }
<grid id="grid" rowRenderer="@{myRowRenderer}" model="@{win$MyController.modeList, load-after='statTimer.onTimer'}" sizedByContent="true"> </grid> <timer id="statTimer" repeat="true" delay="3000"/>
class MyController extends GenericForwardComposer{ List<MyModel> modelList; public void onTimer$statTimer(Event event) { modelList.clear(); repopulateModelList(); } }
Any thoughts ?
Hi
without a runnable example, I don't know which operation will cause slow performance.
from the code, I am guessing, when you use jfreechart, you create all the chart image at server side. if this is the cause, maybe you can try to use client side chart engine
for example, you can try to use flashchart or try Fusion chart
or maybe you can log each operation, to find out which one is the real cause
Thanks samchuang.
You are right, I am using default chart implementation of zk (may be its jfreechart) and it is sending png images each time the model is changed.
I need to show around 40 real time charts( It is a dashboard). can you guide me implementing the best client side charts ( I was evaluating JSChart and HighChart and found them quite good but not sure how to implement with zk)
Hi
so, you don't consider use fusion chart or flashchart in ZK ?
if you wanna to integreate other chart engine, you can refer to ZK_Client-side_Reference
Will it be feasible to show 40 fusion/flash charts in a single page? (Performance wise) ? I however tried fusionchart but was getting error 'Widget required....' . I have integrated JSChart now, testing the performance( However there seems to no JSON support for the dataset in JSChart and x coordinate calibration have some problems. Couldn't integrate Highchart)
Yes, I downloaded zk-Fusionchart-bin-2.2.50-FL-2011-02-21.zip from the same location and taken out the jar file inside it and added it to the WEB-INF/lib folder of my zk project. Then, I added a code to create fusionchart in my composer class(<fusionchart> tag doesn't work and not recognizable) and it throws an error alert while rendering the zul file as something like 'Widget class required for <Fusionchart zYbV82> with default'
Asked: 2011-03-15 11:54:20 +0800
Seen: 1,262 times
Last updated: Mar 22 '11