Comments (6)
I understand your approach involves reading the filter state in the widget initialization and setting the selected categories (CategoryWidget, PieWidget) or bars (HistogramWidget) depending on the current filters applied to the source using the selected column
property. Also, when you select a category or bar, or clear the selected filters, you will directly updating the filters in the source (as it is done today).
For the categories, I don't see a problem because we have an "IN" filter that should be easy to parse.
I'm not sure what will be the approach with selected bars in histograms. Imagine we have a histogram widget with ticks = [1, 5, 10] and we have set the following filter in the same column used by the histogram: BETWEEN 3 AND 7. What should we do in this case?
from carto-react.
Yes @borja-munoz, the HistogramWidget is a different case, but it can be managed easily.
In the filter we have: [1, 5]
, because 5 is the tick number 1, we know that selectedBars
value is [1].
In the filter we have: [10, undefined]
, because undefined is in second place, it means that the selected bar is the last one. Then selectedBars
value is [ticks.length].
In the filter we have: [undefined, 1]
, because undefined is in first place, it means that the selected bar is the first one. Then selectedBars
value is [0].
About your first paragraph:
I would only keep the widget state in the HistogramWidget, in others I would just use filter state as selectedCategories state because it doesn't need any intermediary, you can use it directly.
from carto-react.
But this is not how filters are specified for sources. We specify the filter using BETWEEN (for numeric properties).
Also my question was related to the particular case where the BETWEEN interval in the filter does not match with the breaks/ticks in the histogram. If you are filtering the features with value between 3 and 7, what should you display in the [1-5] and the [5-10] bars?
from carto-react.
If filter value is between 3 and 7 and the ticks are [1,5,10], then those filters are not applied correctly and then the widget won't have selected bars.
from carto-react.
Closing this RFC as the approach for using Redux state instead of local state is being implemented in this PR: #224 by @zbigg
from carto-react.
It is indeed. We agree this is a good proposal
from carto-react.
Related Issues (20)
- FormulaWidget issue with mode global disabled HOT 14
- [RFC] Add a territory selector widget HOT 3
- [RFC] Save custom geometries created with the SpatialFilter HOT 2
- [RFC] Support for Drop a Pin HOT 3
- [RFC] Support for multi-language HOT 3
- [RFC] Comparative Widgets HOT 5
- [RFC] Save the state of the filters HOT 3
- [RFC] Spatial Filter HOT 11
- GeoJSON support in useCartoLayerProps HOT 1
- queryParameters HOT 7
- Remote executeModel doesn't work for POST requests HOT 4
- quadbinZoom error HOT 2
- Hygen is not working HOT 3
- [RFC] Widget size control HOT 1
- [RFC] Export AnimatedNumber component HOT 1
- [Bug] BarWidgetUI
- [RFC] Site Selection - Information element for widgets
- executeSQL function doesn't return the status error
- Allow passing decimal precision as a prop for CategoryWidgetUI HOT 4
- [Bug] ComparativeCategoryWidgetUI progress bar missing background color
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from carto-react.