|
Last change
on this file since a762898 was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
1.6 KB
|
| Line | |
|---|
| 1 | "use strict";
|
|---|
| 2 |
|
|---|
| 3 | Object.defineProperty(exports, "__esModule", {
|
|---|
| 4 | value: true
|
|---|
| 5 | });
|
|---|
| 6 | exports.replaceErrorBar = exports.removeErrorBar = exports.errorBarReducer = exports.addErrorBar = void 0;
|
|---|
| 7 | var _toolkit = require("@reduxjs/toolkit");
|
|---|
| 8 | /**
|
|---|
| 9 | * ErrorBars have lot more settings but all the others are scoped to the component itself.
|
|---|
| 10 | * Only some of them required to be reported to the global store because XAxis and YAxis need to know
|
|---|
| 11 | * if the error bar is contributing to extending the axis domain.
|
|---|
| 12 | */
|
|---|
| 13 |
|
|---|
| 14 | var initialState = {};
|
|---|
| 15 | var errorBarSlice = (0, _toolkit.createSlice)({
|
|---|
| 16 | name: 'errorBars',
|
|---|
| 17 | initialState,
|
|---|
| 18 | reducers: {
|
|---|
| 19 | addErrorBar: (state, action) => {
|
|---|
| 20 | var {
|
|---|
| 21 | itemId,
|
|---|
| 22 | errorBar
|
|---|
| 23 | } = action.payload;
|
|---|
| 24 | if (!state[itemId]) {
|
|---|
| 25 | state[itemId] = [];
|
|---|
| 26 | }
|
|---|
| 27 | state[itemId].push(errorBar);
|
|---|
| 28 | },
|
|---|
| 29 | replaceErrorBar: (state, action) => {
|
|---|
| 30 | var {
|
|---|
| 31 | itemId,
|
|---|
| 32 | prev,
|
|---|
| 33 | next
|
|---|
| 34 | } = action.payload;
|
|---|
| 35 | if (state[itemId]) {
|
|---|
| 36 | state[itemId] = state[itemId].map(e => e.dataKey === prev.dataKey && e.direction === prev.direction ? next : e);
|
|---|
| 37 | }
|
|---|
| 38 | },
|
|---|
| 39 | removeErrorBar: (state, action) => {
|
|---|
| 40 | var {
|
|---|
| 41 | itemId,
|
|---|
| 42 | errorBar
|
|---|
| 43 | } = action.payload;
|
|---|
| 44 | if (state[itemId]) {
|
|---|
| 45 | state[itemId] = state[itemId].filter(e => e.dataKey !== errorBar.dataKey || e.direction !== errorBar.direction);
|
|---|
| 46 | }
|
|---|
| 47 | }
|
|---|
| 48 | }
|
|---|
| 49 | });
|
|---|
| 50 | var {
|
|---|
| 51 | addErrorBar,
|
|---|
| 52 | replaceErrorBar,
|
|---|
| 53 | removeErrorBar
|
|---|
| 54 | } = errorBarSlice.actions;
|
|---|
| 55 | exports.removeErrorBar = removeErrorBar;
|
|---|
| 56 | exports.replaceErrorBar = replaceErrorBar;
|
|---|
| 57 | exports.addErrorBar = addErrorBar;
|
|---|
| 58 | var errorBarReducer = exports.errorBarReducer = errorBarSlice.reducer; |
|---|
Note:
See
TracBrowser
for help on using the repository browser.