Skip to content

Commit

Permalink
Release 2.5.4 (#866)
Browse files Browse the repository at this point in the history
* TimeSeriesWidget: fix echarts props update, to keep state of control when clicking (#865)
  • Loading branch information
zbigg authored Apr 22, 2024
1 parent 129caf0 commit c5b849a
Show file tree
Hide file tree
Showing 13 changed files with 37 additions and 16 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

## 2.5

### 2.5.4 (2024-04-22)

- TimeSeriesWidget: fix echarts props update, to keep state of control when clicking [#865](https://github.com/CartoDB/carto-react/pull/865)

### 2.5.3 (2024-04-18)

- TimeSeriesWidget: support removing series in mounted widget [#863](https://github.com/CartoDB/carto-react/pull/863)
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"packages/*"
],
"npmClient": "yarn",
"version": "2.5.3"
"version": "2.5.4"
}
2 changes: 1 addition & 1 deletion packages/react-api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@carto/react-api",
"version": "2.5.3",
"version": "2.5.4",
"description": "CARTO for React - Api",
"author": "CARTO Dev Team",
"keywords": [
Expand Down
2 changes: 1 addition & 1 deletion packages/react-auth/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@carto/react-auth",
"version": "2.5.3",
"version": "2.5.4",
"description": "CARTO for React - Auth",
"author": "CARTO Dev Team",
"keywords": [
Expand Down
2 changes: 1 addition & 1 deletion packages/react-basemaps/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@carto/react-basemaps",
"version": "2.5.3",
"version": "2.5.4",
"description": "CARTO for React - Basemaps",
"keywords": [
"carto",
Expand Down
2 changes: 1 addition & 1 deletion packages/react-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@carto/react-core",
"version": "2.5.3",
"version": "2.5.4",
"description": "CARTO for React - Core",
"author": "CARTO Dev Team",
"keywords": [
Expand Down
2 changes: 1 addition & 1 deletion packages/react-redux/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@carto/react-redux",
"version": "2.5.3",
"version": "2.5.4",
"description": "CARTO for React - Redux",
"author": "CARTO Dev Team",
"keywords": [
Expand Down
2 changes: 1 addition & 1 deletion packages/react-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@carto/react-ui",
"version": "2.5.3",
"version": "2.5.4",
"description": "CARTO for React - UI",
"author": "CARTO Dev Team",
"keywords": [
Expand Down
14 changes: 14 additions & 0 deletions packages/react-ui/src/custom-components/echarts-for-react/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,20 @@ export default class ReactEcharts extends _ReactEcharts {
}
}

updateEChartsOption() {
const { option, lazyUpdate, showLoading, loadingOption = null } = this.props;
const echartInstance = this.getEchartsInstance();

echartInstance.setOption(option, { replaceMerge: ['series'], lazyUpdate });

if (showLoading) {
echartInstance.showLoading(loadingOption);
} else {
echartInstance.hideLoading();
}
return echartInstance;
}

offEvents(instance, events) {
if (!events) return;
// loop and off
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ export default function TimeSeriesChart({
: theme.palette.action.disabledBackground;

return {
id: String(i),
name,
markLine: i === 0 ? markLine : undefined,
markArea: i === 0 ? markArea : undefined,
Expand Down Expand Up @@ -293,7 +294,6 @@ export default function TimeSeriesChart({
return (
<ReactEcharts
option={options}
notMerge
onEvents={onEvents}
onChartReady={onChartReady}
style={{ height }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import { findItemIndexByTime } from '../utils/utilities';
const events = {};
let initialTimeWindow = null;

// we identify series by their index and stringify it
const seriesFinder = { seriesId: '0' };

export default function useTimeSeriesInteractivity({
echartsInstance,
data,
Expand All @@ -28,7 +31,7 @@ export default function useTimeSeriesInteractivity({
const updateTimelineByCoordinate = useCallback(
(params) => {
if (echartsInstance) {
const [x] = echartsInstance.convertFromPixel({ seriesIndex: 0 }, [
const [x] = echartsInstance.convertFromPixel(seriesFinder, [
params.offsetX,
params.offsetY
]);
Expand Down Expand Up @@ -87,7 +90,7 @@ export default function useTimeSeriesInteractivity({

// Move markArea
if (timeWindow.length === 2) {
const [x] = echartsInstance.convertFromPixel({ seriesIndex: 0 }, [
const [x] = echartsInstance.convertFromPixel(seriesFinder, [
params.offsetX,
params.offsetY
]);
Expand All @@ -101,7 +104,7 @@ export default function useTimeSeriesInteractivity({

if (echartsInstance) {
setIsMarkAreaSelected(true);
const [x] = echartsInstance.convertFromPixel({ seriesIndex: 0 }, [
const [x] = echartsInstance.convertFromPixel(seriesFinder, [
params.offsetX,
params.offsetY
]);
Expand All @@ -125,7 +128,7 @@ export default function useTimeSeriesInteractivity({
}

if (isMarkAreaSelected && echartsInstance) {
const [x] = echartsInstance.convertFromPixel({ seriesIndex: 0 }, [
const [x] = echartsInstance.convertFromPixel(seriesFinder, [
params.offsetX,
params.offsetY
]);
Expand Down Expand Up @@ -164,7 +167,7 @@ export default function useTimeSeriesInteractivity({
}

if (isMarkAreaMoving && echartsInstance) {
const [x] = echartsInstance.convertFromPixel({ seriesIndex: 0 }, [
const [x] = echartsInstance.convertFromPixel(seriesFinder, [
params.offsetX,
params.offsetY
]);
Expand Down
2 changes: 1 addition & 1 deletion packages/react-widgets/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@carto/react-widgets",
"version": "2.5.3",
"version": "2.5.4",
"description": "CARTO for React - Widgets",
"author": "CARTO Dev Team",
"keywords": [
Expand Down
4 changes: 2 additions & 2 deletions packages/react-workers/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@carto/react-workers",
"version": "2.5.3",
"version": "2.5.4",
"description": "CARTO for React - Workers",
"author": "CARTO Dev Team",
"keywords": [
Expand Down Expand Up @@ -66,7 +66,7 @@
},
"dependencies": {
"@babel/runtime": "^7.13.9",
"@carto/react-core": "^2.5.3",
"@carto/react-core": "^2.5.4",
"@turf/bbox-polygon": "^6.3.0",
"@turf/boolean-intersects": "^6.3.0",
"@turf/boolean-within": "^6.3.0",
Expand Down

0 comments on commit c5b849a

Please sign in to comment.