Interaction without re-rendering


#1

Hi all, we’ve built a simple app with some visualizations. We can add/remove and modify filters with the Interaction Manager. Now we want to provide a higher level of interactivity thru an UI we are building where our final users will be able to change some chart options just like groups, metrics and some other just similar to this: https://chartfactor.com/doc/1.11/demos_pages/cf-demos/react-demo/

We’ve done some initial test but when we change the chart, new queries are executed. Is there a way to avoid this?


#2

Well this depends. Some options cannot be set without re-execute the visualization (and thus trigger new queries). I’m talking about groups, metrics, fields and any other method that by changing them, will impact the data that is received from the server.

Some other options are available without having to re-execute the query. For example any chart related option as described here: Visualization options. Also you may take a look into the specific documentation for each visualizations since some of them have options that are not common or not shared with the others.

Hope this helps


#3

I have a question on this area. According to the documentation everytime we use cf.provider() or cf.create() a new visualization is created. What happens if I need to re-execute the entire visualization code due to setting options that are only effective over initialization? Does that create more instances? Are they destroyed somehow?


#4

Yes, cf.provider() and cf.create() are the way to create new aktive instances. The key of an instance is its the element name, which is specified with the .element() method, and it has to be unique.

When ChartFactor detects that a new visual is created and it is using an existing element name, it will replace the old instance with the new one, so you will have the same amount that at the beginning.

Creating new visuals without an element doesn’t make sense since it is required to execute the aktive, unless you are planning to add the element later.


#5

What is the difference between .create() and .provider()?, when do I have to use one or another? I mean, most of the time I use cf.provider(‘MyProvider’), but never used .create() before.


#6

For most of the visualizations cf.provider('Provider Name') is enough to create a visual and pass the provider to use.

cf.create() is used mainly for the following cases:

To create visualizations that don’t do queries to the server just as the Interaction Manager, Text Search…, because they are not related with any provider and source.

To create visualization with custom data.

To create multi-query visualizations in order to identify each query. This is the only case where both: cf.provider() and cf.create() are used together.