Closed panthony closed 5 years ago
@kt3k Hello there, I was looking to cache some function returns and I noticed the cache.js
file.
Look how it is used I found that this is mostly used by load()
through cacheIds
but:
Do you know how/if this is used ? Would it be possible to drop the support for it ?
My intent would be to modify the cache interface to be used in more contexts internally.
Merging #2670 into master will decrease coverage by
0.04%
. The diff coverage is80.37%
.
@@ Coverage Diff @@
## master #2670 +/- ##
==========================================
- Coverage 80.13% 80.08% -0.05%
==========================================
Files 57 57
Lines 4520 4605 +85
==========================================
+ Hits 3622 3688 +66
- Misses 898 917 +19
Impacted Files | Coverage Δ | |
---|---|---|
src/config.js | 95.83% <ø> (ø) |
:arrow_up: |
src/data.load.js | 58% <100%> (+1.75%) |
:arrow_up: |
src/domain.js | 93.75% <100%> (+0.07%) |
:arrow_up: |
src/shape.bar.js | 98.66% <100%> (+0.01%) |
:arrow_up: |
src/cache.js | 63.15% <100%> (+26.79%) |
:arrow_up: |
src/tooltip.js | 77.23% <100%> (+0.37%) |
:arrow_up: |
src/api.data.js | 100% <100%> (ø) |
:arrow_up: |
src/axis.js | 97.56% <100%> (ø) |
:arrow_up: |
src/arc.js | 73.33% <50%> (-0.63%) |
:arrow_down: |
src/shape.js | 76.92% <69.23%> (-1.77%) |
:arrow_down: |
... and 2 more |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update a4c971c...c54d5cf. Read the comment docs.
Merging #2670 into master will increase coverage by
0.29%
. The diff coverage is94.4%
.
@@ Coverage Diff @@
## master #2670 +/- ##
==========================================
+ Coverage 80.29% 80.58% +0.29%
==========================================
Files 59 59
Lines 4537 4631 +94
==========================================
+ Hits 3643 3732 +89
- Misses 894 899 +5
Impacted Files | Coverage Δ | |
---|---|---|
src/config.js | 95.83% <ø> (ø) |
:arrow_up: |
src/scale.js | 100% <100%> (ø) |
:arrow_up: |
src/shape.bar.js | 98.66% <100%> (+0.01%) |
:arrow_up: |
src/data.load.js | 58% <100%> (+1.75%) |
:arrow_up: |
src/cache.js | 63.15% <100%> (+26.79%) |
:arrow_up: |
src/domain.js | 93.75% <100%> (+0.07%) |
:arrow_up: |
src/util.js | 100% <100%> (ø) |
:arrow_up: |
src/axis.js | 97.58% <100%> (+0.02%) |
:arrow_up: |
src/tooltip.js | 77.23% <100%> (+0.37%) |
:arrow_up: |
src/arc.js | 74.57% <50%> (-0.6%) |
:arrow_down: |
... and 3 more |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update bdf12d1...9b94955. Read the comment docs.
Big part of untested added code is to be used when padAngle
option will be available (see #2669).
Can't add a test for it right now :/
@panthony Personally I think these cache APIs don't belong to "public API" and we can change (or replace) them as long as the existing charts work.
@kt3k One of the usage of this cache was "recently" added for gauge, but I think the value could be retrieved another way:
return $$.levelColor($$.cache[id].values[0].value);
Otherwise, the only usage is load({ cacheIds: [] })
. But I don't really know how it was (is?) used.
The example looks great! 👍
@kt3k I added a new exemple of a combinaison chart using stack normalisation per axis basis:
Hi! Thank you so much for this feature! I'm trying to use normalized stacked bar chart in a project. It works as expected except for the tooltip. The tooltip still shows the original values, instead of normalized or percentage values. Do I need to set anything else to display the tooltip values in percentages?
Edit: Figured out a solution almost as soon as I posted this 😅
tooltip: {
format: {
value(value, ratio) {
return `${ratio * 100}%`;
},
},
}
Can be configured using:
Defaults to false.
Closes #142