Interactive Charts

1
Dear Mendix Community,   I am rather new to Mendix development and I am currently exploring the apps capabilities in terms of displaying data. I have already learned how to build charts with the AnyChart module based on the plotly.js library. My question is if it is also possible to make the data more interactive in terms of adding filters to a web page that also allow making multiple selections and having the charts update on runtime.   Hope someone can help me out :)   Ruben
asked
2 answers
0

Hi Ruben, 

When you already know how to work with the anychart module, this should be easy. 

Create a non persistent helper entity with attributes that contain the filter, f.e. a string search field and a enumeration field. 

Create a dataview with the helper entity on your page surrounding the chart widget, make sure the source is microflow and create/return the helper entity there. place the attributes from the helper entity in the dataview. 

Set an on change microflow to change actions of the attributes from the helper entity, make sure you refresh the helper entity in the on change event. This will also trigger the anychart data to refresh. 

Now when the anychart microflow, that creates the json, is refreshed, you should be able to add the helper entity here as argument to this microflow and use the values here to filter data.

answered
0

I am having a similar problem, but even with the answer provided, I still can't resolve it.

 

image.png

As shown above, I have a Data View that uses a microflow as a source. This microflow creates a non-persistent DisplayOptions object, which allows for showing the 2 options in the radio button. I activate the refresh on Client option on this object:

image.png

 

The inner Data View uses a second microflow as a source, where I create the JSON string to populate the plot via a Java action:

 

image.png

 

In this microflow, I get the DisplayOption as a parameter and I can confirm that the JSON string is updating correctly. I add the string to an attribute of the object that I create and I also activate Refresh in Client here.

 

My Any Chart object gets the Source Attribute from the only option available, which is the attribute of the object that I created with the microflow above:

 

image.png

 

With these steps, the plot is not updating (but I can see the JSON string being updated after changing the radio button via messages). What am I missing?

answered