keen / keen-dataviz.js

Data Visualization Charting Library
MIT License
224 stars 48 forks source link

Column chart displaying columns from previous render #167

Closed formatkaka closed 5 years ago

formatkaka commented 5 years ago

Hello, I have plotted a columnchart visualization of data using keen-DataViz. I have applied an in filter to a query.

I modify the filter parameter property_value based on user input (through HTML dropdown).

Post modification, I make a request for updated data and re-render the graph. It behaves weird on re-render.

I get graph like image attached. The values 1,2,3,4 on x-axis are invalid and columns being shown corresponding to them are from another plot.

The problem happens, when I switch between values in the dropdown. Individually all them render correctly. What might be the issue?

Looks like this is an issue with columnchart and barchart type. Works perfectly in table and piechart

image

Regards

adamkasprowicz commented 5 years ago

Hi there! Which version of keen-dataviz do you use to generate this chart? The easiest solution would be to create a new fresh keenDataviz instance on every property_value change. I'll investigate why the second render on the same keenDataviz instance doesn't generate the correct chart.

formatkaka commented 5 years ago

Hello, I am currently using version 3.5.2. I'll try to share code snippet with you which demonstrates the problem.

It works fine when I create a new instance, but I guess it would be an antipattern.

Regards

adamkasprowicz commented 5 years ago

Hi @formatkaka , Please take a look at the example here: https://github.com/keen/keen-dataviz.js#refresh-every-1-minute I think that the config's property clearOnRender: true should fix your issue.