Drilldown series MVVM

asked 2021-07-16 15:57:27 +0800

aUser gravatar image aUser
125 4

updated 2021-07-16 19:27:18 +0800


I'm interested in using a chart like this one.

I just need one level of drilldown and be able to come back to the original series. I would like to use the MVVM approach though and for now i can only set some series but without any drilldowns. I used the PieModel to set the values but i can't find a way to create drilldowns.

<charts type="pie" model="@load(myVM.model)" />

PieModel pieModel = new DefaultPieModel();
pieModel.setValue(categoryDescription, myValue);

My only idea is to pass the charts component from the zul page to the MVVM on the onPlotClick event for example and use that to set the drilldowns, but this is extremely ugly.. I would have to re-calculate the series and implement the back button i guess.

Isn't there a way to actually set these drilldowns in a MVVM approach? I would like to avoid mixing MVC and MVVM approaches.

Thank you

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted

answered 2021-07-19 15:35:58 +0800

cor3000 gravatar image cor3000
6005 2 7
ZK Team

The ChartsModels don't contain drilldown information and there is also no dedicated MVVM way here.

In this case you have to access the Charts component directly (or through its ChartsApi interface).

I try to keep the configuration code separate, to have only a single "ugly" method delegating the chart configuration which can become complex in many cases. It's often more than just setting up the data - something you don't want in a view model anyway like colors, formats, paddings, axis configuration, drilldown...

public void configureChart(@BindingParam("chart") Charts chart) {
    ChartUtil.configureIncomeHistoryChart(chart, anyInfoFromVM);

In the zul file you can bind the configureChart-command to any event e.g. onCreate.

<charts onCreate="@command('configureChart', chart=self)"/>
link publish delete flag offensive edit


Thank you, perfectly clear

aUser ( 2021-07-19 15:39:31 +0800 )edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

1 follower



Asked: 2021-07-16 15:57:27 +0800

Seen: 8 times

Last updated: Jul 19

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More