Q:I create dynamically ZK Charts in a panel and i want to fit the chart to the panel size if it gets max/minimized.
I found Chart Resize, but since i do it dynamically i got stuck.
Div div = new Div();
div.setHflex("1");
div.setVflex("1");
div.addEventListener(Events.ON_AFTER_SIZE, new EventListener<Event>() {
@Override
public void onEvent(Event event) throws Exception {
chart.setWidth(event.getWidth() + "px");
}
});
div.appendChild(chart);
it says **"The method getWidth() is undefined for the type Event"**
Ans:
you should use AfterSizeEvent
div.addEventListener(Events.ON_AFTER_SIZE, new EventListener<AfterSizeEvent>() {
public void onEvent(AfterSizeEvent event) throws Exception {
//do something
}
}
I found Chart Resize, but since i do it dynamically i got stuck.
Div div = new Div();
div.setHflex("1");
div.setVflex("1");
div.addEventListener(Events.ON_AFTER_SIZE, new EventListener<Event>() {
@Override
public void onEvent(Event event) throws Exception {
chart.setWidth(event.getWidth() + "px");
}
});
div.appendChild(chart);
it says **"The method getWidth() is undefined for the type Event"**
Ans:
you should use AfterSizeEvent
div.addEventListener(Events.ON_AFTER_SIZE, new EventListener<AfterSizeEvent>() {
public void onEvent(AfterSizeEvent event) throws Exception {
//do something
}
}
No comments:
Post a Comment