Compare commits

...

197 Commits

Author SHA1 Message Date
Emmad Usmani
6a692e8e39 remove extra padding 2024-04-17 10:40:40 -07:00
Emmad Usmani
bbf0817051 fix combined cards tooltip (#41482) 2024-04-17 07:38:25 -07:00
Jesse Devaney
fe77cd7af5 Fix e2e-tests-embedding-ee (#41336)
* fix embedding-linked-filters.cy.spec.js

* fix embedding-questions.cy.spec.js

* revert E2E update

* refactor helpers

* fix filter.cy.spec.js
2024-04-16 13:40:14 -04:00
Emmad Usmani
bf8e1e8232 fix incorrect axis title
Closes https://github.com/metabase/metabase/issues/41285

### Description

Fixes the y-axis title being incorrect when there is a split. This is done by using the name of the series from the series model.

### Demo

![Screenshot 2024-04-15 at 2.11.26 PM.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/9ULpbAzGBtvQRyZEpGvu/03020ce1-ab38-44cd-83a0-641722598657.png)

### Checklist

- [x] Tests have been added/updated to cover changes in this PR
2024-04-16 08:27:56 -07:00
Emmad Usmani
9068947044 fix image cut off
Closes https://github.com/metabase/metabase/issues/37275
Closes https://github.com/metabase/metabase/issues/41278

### Description

The root cause was `yTicksWidthLeft` being too large. This happened because the `areDecimalTicksExpected` heuristic in `getYAxisTicksWidth` would be `true` even when the `number_style` column setting was set to `percent`, causing us to use the raw decimal value for the measurement, which was different from the actual value used.

To fix this we round the values to the nearest hundredth if `number_style` is `percent`.

### Demo

![Screenshot 2024-04-05 at 11.06.49 AM.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/9ULpbAzGBtvQRyZEpGvu/963a4c45-5c66-423e-99d8-88c22f642f29.png)

### Checklist

- [x] Tests have been added/updated to cover changes in this PR

Note that I've anonymized the question data before adding it as a test case.
2024-04-16 08:24:58 -07:00
Aleksandr Lesnenko
19c60496b2 fix echarts dataset unit tests (#41228) 2024-04-16 11:08:54 -03:00
Aleksandr Lesnenko
7eb7d01393 fix static viz webpack config (#41453) 2024-04-15 17:41:02 -04:00
Jesse Devaney
a7e528a41f fix replayio cypress errors (#41454) 2024-04-15 17:39:18 -04:00
Aleksandr Lesnenko
0a0850cd56 hide axes on small dashcards (#41297) 2024-04-15 16:45:53 -03:00
Aleksandr Lesnenko
56ac34716f fix legend hover does not focus on series, fix area blur style (#41299) 2024-04-15 16:40:12 -03:00
Aleksandr Lesnenko
04b84d54e1 fix scatter y-axis range (#41316) 2024-04-15 16:31:15 -03:00
Aleksandr Lesnenko
9363f707f6 fix incorrect tooltip values (#41385) 2024-04-15 12:35:00 -03:00
Aleksandr Lesnenko
d0b495ed2f Improve echarts hovers (#41343)
* improve echarts hovering

* remove resize lag on load
2024-04-15 12:34:20 -03:00
Aleksandr Lesnenko
aee428ebe4 update yarn.lock 2024-04-15 03:04:09 -03:00
Jesse Devaney
16e943c16b Fix e2e-tests-dashboard-cards-ee (#41214)
* for ordinal and histogram scales, make x-axis labels respect column formatting settings

* refactor logic

* fix 0 not being formatted

* refactor

* fix localization.cy.spec.js

* move parseNumberValue to shared utils code

* check type of column before formatting as a number

* add ECharts e2e test helpers from PR #39919

* refactor old tests to use echarts helpers

* [ECharts] fix longitude.cy.spec.js tests

* [ECharts] fix sql.cy.spec.js tests

* [ECharts] fix qb-regular-table.cy.spec.js tests

* [ECharts] fix qb-explicit-joins.cy.spec.js tests

* [ECharts] fix binning-reproductions.cy.spec.js tests

* fix spec

* fix spec

* fix spec

* fix spec

* fix spec

* fix spec

* fix spec

* fix longitude.cy.spec.js

* fix e2e-custom-column-ee failing tests

* fix e2e-dashboard-ee failing tests

* fix e2e-dashboard-cards-ee failing tests
2024-04-15 02:57:17 -03:00
Aleksandr Lesnenko
00fb39f347 remove old unused line area bar combo code (#41229) 2024-04-15 02:56:34 -03:00
Aleksandr Lesnenko
7a3525ba78 fix echarts trend lines (#41152)
* fix echarts trend lines

* specs

* fix missed any

* Update Loki Snapshots

---------

Co-authored-by: Metabase bot <metabase-bot@metabase.com>
2024-04-15 02:56:34 -03:00
Aleksandr Lesnenko
c4bfb55be9 fix batch of e2e specs that interact with line area bar charts (#41227)
* fix batch of e2e specs that interact with line area bar charts

* more specs

* more specs
2024-04-15 02:56:33 -03:00
Jesse Devaney
64d123f5a5 Fix e2e-tests-dashboard-ee (#41211) 2024-04-15 02:56:15 -03:00
Jesse Devaney
f4e992f19f Fix e2e-tests-custom-column-ee (#41210) 2024-04-15 02:56:15 -03:00
Aleksandr Lesnenko
db94263f24 fix data labels default settings computation for static viz (#41109) 2024-04-15 02:56:15 -03:00
Adam James
2f5c282733 Fix up backend for echarts 2024-04-15 02:56:15 -03:00
Jesse Devaney
6ca8e06c50 Fix e2e-tests-binning-ee (#41146)
* for ordinal and histogram scales, make x-axis labels respect column formatting settings

* refactor logic

* fix 0 not being formatted

* refactor

* fix localization.cy.spec.js

* move parseNumberValue to shared utils code

* check type of column before formatting as a number

* add ECharts e2e test helpers from PR #39919

* refactor old tests to use echarts helpers

* [ECharts] fix longitude.cy.spec.js tests

* [ECharts] fix sql.cy.spec.js tests

* [ECharts] fix qb-regular-table.cy.spec.js tests

* [ECharts] fix qb-explicit-joins.cy.spec.js tests

* [ECharts] fix binning-reproductions.cy.spec.js tests

* fix E2E spec
2024-04-15 02:56:15 -03:00
Jesse Devaney
5cd0e6d5c4 Fix e2e-tests-admin-ee (#40937)
* for ordinal and histogram scales, make x-axis labels respect column formatting settings

* refactor logic

* fix 0 not being formatted

* refactor

* fix localization.cy.spec.js

* move parseNumberValue to shared utils code

* check type of column before formatting as a number
2024-04-15 02:56:15 -03:00
Aleksandr Lesnenko
14c02b7c0e minimize echarts shape transitions (#41156) 2024-04-15 02:56:15 -03:00
Emmad Usmani
4787776441 fix ordinal axis labels (#40693)
* fix ordinal axis labels

* add test

* update snapshots

* fix axis title position

* move function to utils

* update snapshots

* save setting in chartMeasurements

* update snapshots

* address feedback

* update snapshots

* fix ticks rotation (#41093)

* Update Loki Snapshots

---------

Co-authored-by: Aleksandr Lesnenko <alxnddr@users.noreply.github.com>
Co-authored-by: Metabase bot <metabase-bot@metabase.com>
2024-04-15 02:56:15 -03:00
Anton Kulyk
97066fa268 Remove debugging code 2024-04-15 02:56:15 -03:00
Aleksandr Lesnenko
8d3637feff fix relative date time x-axis ticks (#41001) 2024-04-15 02:56:15 -03:00
Jesse Devaney
6f24897494 Fix ordinal scale x-axis tick labels for numeric columns (#41055)
* fix ordinal scale x axis tick labels when formatting a numeric column

* add visual variant for ordinal x-axis with relative datetimes

* Update Loki Snapshots

---------

Co-authored-by: Metabase bot <metabase-bot@metabase.com>
2024-04-15 02:56:15 -03:00
Aleksandr Lesnenko
55cbbd2cc2 test text measuring fix 2024-04-15 02:56:15 -03:00
Aleksandr Lesnenko
771bbbd2f8 Revert "Try using a separate canvas object for each cartesian chart (#41048)"
This reverts commit 8859c10b18.
2024-04-15 02:56:15 -03:00
Jesse Devaney
8ed8fb03eb Fix histogram and ordinal x-axis scales not respecting column formatting (#40828)
* for ordinal and histogram scales, make x-axis labels respect column formatting settings

* refactor logic

* fix 0 not being formatted

* refactor

* move parseNumberValue to shared utils code

* check type of column before formatting as a number

* Update Loki Snapshots

---------

Co-authored-by: Metabase bot <metabase-bot@metabase.com>
2024-04-15 02:56:13 -03:00
Anton Kulyk
5670664bbf Try using a separate canvas object for each cartesian chart (#41048)
* Extract `createTextMeasurer`

* Use separate canvas for each cartesian chart
2024-04-15 02:55:54 -03:00
Emmad Usmani
a01821de7e show unexpected and multiple timezones warnings
Closes https://github.com/metabase/metabase/issues/39562

### Description

Shows warnings related to timezones.

### Demo

Not really sure how to test this one locally without setting up multiple databases in different timezones. We could merge this and later confirm is works on the echarts cloud instance for the relevant questions.
2024-04-15 02:55:54 -03:00
Emmad Usmani
dcec4191f0 show invalid date warning
Part of https://github.com/metabase/metabase/issues/39562

### Description

Shows a warning when a chart with a timeseries x-axis scale has non-date values in the dimension column.

### Demo

![Screenshot 2024-03-28 at 1.50.12 PM.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/9ULpbAzGBtvQRyZEpGvu/b9111ed9-bf66-40dd-a758-320a5250bee5.png)

![Screenshot 2024-03-28 at 1.50.36 PM.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/9ULpbAzGBtvQRyZEpGvu/c3d4474e-d8a2-42e4-8f0f-94d4264c5b46.png)
2024-04-15 02:55:54 -03:00
Emmad Usmani
9c9a5a59fa show null dimension value warning
Part of https://github.com/metabase/metabase/issues/39562

### Description

Shows the warning symbol when the dimension axis contains null values, but only for timeseries and numeric x-axis, since the ordinal x-axis does render null dimension values.

Adding this to the waterfall chart inadvertently fixed another bug that we missed: numeric x-axis scales would have gaps in the waterfall series if there were null dimension values. I've added some tests to cover this.

Also note that I've updated many unrelated snapshots in this PR. Not sure why, but my power and log y-axis scale refactor snapshots weren't on the `echarts` branch, perhaps we accidentally deleted them while rebasing.

### Demo

![Screenshot 2024-03-28 at 12.20.11 PM.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/9ULpbAzGBtvQRyZEpGvu/34cf0955-1e46-4ffb-9431-ca27d8694728.png)

![Screenshot 2024-03-28 at 12.20.19 PM.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/9ULpbAzGBtvQRyZEpGvu/7a116917-e6cf-45f2-a50a-ba4ddf26b481.png)

![Screenshot 2024-03-28 at 12.28.35 PM.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/9ULpbAzGBtvQRyZEpGvu/0a7647ee-c52b-4660-b115-9df15de1b4ee.png)

![Screenshot 2024-03-28 at 12.33.01 PM.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/9ULpbAzGBtvQRyZEpGvu/eeca2d4f-c8c1-4245-abad-9d1d99322659.png)

![Screenshot 2024-03-28 at 1.02.34 PM.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/9ULpbAzGBtvQRyZEpGvu/aa8a1d62-562f-4c50-bf76-a3a80c10323d.png)
2024-04-15 02:55:54 -03:00
Emmad Usmani
5724b440cf show warning for unaggregated dimension
Part of https://github.com/metabase/metabase/issues/39562

### Description

Shows the warning symbol and message in the query builder view when the chart's dataset has unaggregated dimension values.

I'll add the other warnings in child PRs.

### Demo

![Screenshot 2024-03-28 at 12.08.04 PM.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/9ULpbAzGBtvQRyZEpGvu/ba4c93f3-5e58-4ce4-9a85-5d75c5310d34.png)

![Screenshot 2024-03-28 at 12.08.10 PM.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/9ULpbAzGBtvQRyZEpGvu/e4035a60-68a2-46b7-b262-58fa88995c86.png)

![Screenshot 2024-03-28 at 12.15.05 PM.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/9ULpbAzGBtvQRyZEpGvu/83815a94-1e4a-468a-876f-3b39effb8b1b.png)
2024-04-15 02:55:54 -03:00
Aleksandr Lesnenko
4b6266e513 fix line charts broken due to stacking settings (#40997)
* fix line charts broken due to stacking settings
2024-04-15 02:55:54 -03:00
Anton Kulyk
b91f415604 Debugging help for dashcard resizing (2) 2024-04-15 02:55:54 -03:00
Anton Kulyk
3a46c7d35b Debugging help for dashcard resizing 2024-04-15 02:55:54 -03:00
Aleksandr Lesnenko
608aaa29e1 fix timeline events render on top of series (#40931)
* fix timeline events render on top of series

* unhardcode z-index
2024-04-15 02:55:54 -03:00
Aleksandr Lesnenko
094f64c177 fix waterfall ordinal x null values tick (#40782) 2024-04-15 02:55:54 -03:00
Aleksandr Lesnenko
d481805e0b fix drills on combined scalars and funnel bars (#37769) 2024-04-15 02:55:54 -03:00
Aleksandr Lesnenko
d141c01482 enable text selection on non-brushable charts (#40879) 2024-04-15 02:55:54 -03:00
Jesse Devaney
57192035a6 fix brushing (#40928) 2024-04-15 02:55:54 -03:00
Aleksandr Lesnenko
8ee1a38690 fix rebase 2024-04-15 02:55:54 -03:00
Aleksandr Lesnenko
ed8690a3d2 Fix data labels blur on single series (#40781)
* fix data labels blur on single series

* review
2024-04-15 02:55:54 -03:00
Aleksandr Lesnenko
0beeba8682 ignore duplicated metrics columns in viz settings (#40779) 2024-04-15 02:55:54 -03:00
Aleksandr Lesnenko
93907a0faa hide null values from stacked tooltip (#40778) 2024-04-15 02:55:54 -03:00
Jesse Devaney
363c2d1a66 Fix custom y axis range for pow and log scales (#40703)
* fix custom y-axis range for pow scale

* remove dead code

* resolve merge conflicts

* refactor to reuse transform functions

* Add visual variants for log and pow y-axis scales with custom ranges
2024-04-15 02:55:54 -03:00
Aleksandr Lesnenko
6f067e3c7a fix echarts timezone issues (#40706)
* fix timezone issues

* snapshots
2024-04-15 02:55:54 -03:00
Emmad Usmani
f99fc7bf26 refactor log scale to use numeric transforms
Closes
https://github.com/metabase/metabase/issues/38780
https://github.com/metabase/metabase/issues/40212

### Description

Refactors the log y-axis scale to use our own transformation, like we do for the power scale, in order to fix the aforementioned issues.

### Demo

![Screenshot 2024-03-25 at 11.53.57 AM.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/9ULpbAzGBtvQRyZEpGvu/cac4c8f0-72e7-49c5-b781-0546b243d0f1.png)

### Checklist

- [x] Tests have been added/updated to cover changes in this PR
2024-04-15 02:55:54 -03:00
Emmad Usmani
6e3df60c4d refactor pow scale to use NumericAxisScaleTransforms
Preparation for 
https://github.com/metabase/metabase/issues/38780
https://github.com/metabase/metabase/issues/40212

### Description

In order to fix the aforementioned log scale issues, we will need to use our own data transformations for the log scale, instead of using echarts' built in option.

Before doing that, I am refactoring the power y-axis scale to use a more generalized transformation system, similar to what we do for the x-axis scales. That way, power and log y-axis scales can use a unified transformation system, and do not have be dealt with uniquely at different touch points (e.g. tick labels, data labels, chart measurements, etc).

### Demo

![Screenshot 2024-03-21 at 11.38.21 AM.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/9ULpbAzGBtvQRyZEpGvu/cb283ea4-b0d8-4ba1-861b-d9559e81121f.png)

### Checklist

~~- [ ] Tests have been added/updated to cover changes in this PR~~

_Don't need to add new tests right now since this is just a refactor, but will confirm existing tests don't fail._
2024-04-15 02:55:54 -03:00
Jesse Devaney
73ae731a26 Add auto formatting to stacked charts (#40656)
* refactor data label formatter to match stacked use case

* add auto compacting to stacked charts
2024-04-15 02:55:54 -03:00
Anton Kulyk
496859d7ef Move trend line computation to chart model (#40581)
* Move trend line computation to chart model

* Add `BaseSeriesModel` and `TrendLineSeriesModel`
2024-04-15 02:55:54 -03:00
Aleksandr Lesnenko
1bf87ae4e6 prevent waterfall from not showing anything when pow or log x-axis scale has been selected previously (#40541)
* prevent waterfall from not showing anything when pow or log x-axis scale has been selected previously

* review
2024-04-15 02:55:54 -03:00
Jesse Devaney
b76a5e5b43 fix auto formatting performance issue (#40531) 2024-04-15 02:55:54 -03:00
Jesse Devaney
4fc21ac7c7 Fix goal line emphasis on hovering (#40485)
* prevent line emphasis for goal lines

* refactor lineStyle to re-use styling
2024-04-15 02:55:54 -03:00
Jesse Devaney
9060091ff0 fix hover events for transformed datasets that have indexes differing from the original datasets indexes (#40473) 2024-04-15 02:55:54 -03:00
Aleksandr Lesnenko
aa781e1eb2 fix time series x-axis ticks bugs (#40339)
* fix time series x-axis ticks bugs

* specs

* fix passing unsupported units to the formatter

* review, fix type error
2024-04-15 02:55:54 -03:00
Aleksandr Lesnenko
2b0dd37872 fix legend interaction points to incorrect series (#40470) 2024-04-15 02:55:54 -03:00
Jesse Devaney
bed0ccb262 Add auto formatting logic for ECharts data labels (#40321)
* add auto formatting logic to ECharts data label formatter

* refactor function

* add visual variants for auto formatting data labels

* Update Loki Snapshots

---------

Co-authored-by: Metabase bot <metabase-bot@metabase.com>
2024-04-15 02:55:54 -03:00
Anton Kulyk
569ab7472d Fix areas render under bars in combo charts (#40314)
* Increase z-index for line and area charts

* Add visual test snapshot

* Update screenshots

* Add story
2024-04-15 02:55:54 -03:00
Emmad Usmani
5188dad25d fix stacked pow scale
Closes https://github.com/metabase/metabase/issues/40210

### Description

We needed to handle the power y-axis scale differently for stacked charts.

### Demo

| Stats | This PR |
|--------|--------|
|  <img width="1886" alt="Screenshot 2024-03-19 at 3 02 24 PM" src="https://github.com/metabase/metabase/assets/37751258/68d12b21-40a8-491a-bffc-0a386cfdf2a4"> | <img width="1867" alt="Screenshot 2024-03-19 at 3 02 45 PM" src="https://github.com/metabase/metabase/assets/37751258/ad0f8b1a-6499-4ada-bf8c-db1c59c791e6"> | 

### Checklist

- [x] Tests have been added/updated to cover changes in this PR
2024-04-15 02:55:54 -03:00
Anton Kulyk
5f226693b9 Use series names in click/hover object data (#40302) 2024-04-15 02:55:54 -03:00
Aleksandr Lesnenko
0656b6e5f5 fix showing comparison tooltip on single series (#40270) 2024-04-15 02:55:54 -03:00
Emmad Usmani
449713a3c9 fix waterfall null data labels (#40264)
* fix waterfall null data labels

* storybook test

* Update Loki Snapshots

---------

Co-authored-by: Metabase bot <metabase-bot@metabase.com>
2024-04-15 02:55:54 -03:00
Emmad Usmani
76628135d1 fix unaggregated dimension tooltip (#40266) 2024-04-15 02:55:53 -03:00
Jesse Devaney
34f258a700 hide split lines when visualization setting "graph.y_axis.axis_enabled"` is set to "hide"/false (#40260) 2024-04-15 02:55:53 -03:00
Emmad Usmani
0d1a4945f5 fix histogram label positioning
Closes https://github.com/metabase/metabase/issues/39564

### Description

To fix the inaccurate placement, there are two things we need to do:

1. Position the labels on the left of the bar, instead of the center

We do this by adding a `padding` option to `xAxis.axisLabel` in `option/axis.ts`

2. Add a label for the end of the last bin

3. Add padding to the sides of the bars (wasn't mentioned in the original issue, but it's also a regression from the old implementation)

We achieve both of these by adding two extra values to the chart dataset, one at the beginning where the x-axis value is less than the minimum dimension value by one bin interval, and one at the end where the x-axis value is greater than the maximum dimension value by one bin interval.

Note that the padding is larger than it was on the old implementation. Unfortunately there's no easy way to fix this, the padding has to be one dimension width, echarts does not allow customization of a single datum's width in a bar series.

### Demo

![Screenshot 2024-03-12 at 11.16.50 AM.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/9ULpbAzGBtvQRyZEpGvu/9932f1e7-5642-4cd9-afcd-eb6a5cd4569c.png)

### Checklist

- [x] Tests have been added/updated to cover changes in this PR
2024-04-15 02:55:53 -03:00
Emmad Usmani
6d013f97e8 fix incorrect y-axis range
Closes https://github.com/metabase/metabase/issues/39596

### Description

The root cause was that we were including datums with null dimension values on timeseries, numeric (linear, log, power) and histogram charts, when they actually should be excluded from the dataset since we don't render them.

We fix this by filtering out those datums before applying other dataset transformations.


### Demo

<img width="561" alt="Screenshot 2024-03-14 at 4 34 50 PM" src="https://github.com/metabase/metabase/assets/37751258/54cdd165-6320-4230-99ad-672614e80697">

### Checklist

- [x] Tests have been added/updated to cover changes in this PR
2024-04-15 02:55:53 -03:00
Aleksandr Lesnenko
c4d6b02546 fix showing series comparison tooltip on non-stacked charts (#40190) 2024-04-15 02:55:53 -03:00
Jesse Devaney
36f26cf471 Fix missing tooltip for goal line label (#40150)
* fix missing tooltip for goal line label

* address feedback - update component check
2024-04-15 02:55:53 -03:00
Aleksandr Lesnenko
f6afa3d973 fix messed up stacked areas with various missing.values setting (#40157) 2024-04-15 02:55:53 -03:00
Aleksandr Lesnenko
c332e4bc17 fix stack display setting (#40116) 2024-04-15 02:55:53 -03:00
Emmad Usmani
4ad8ac58af fix insights error (#40104)
* fix insights error

* Update Loki Snapshots

---------

Co-authored-by: Metabase bot <metabase-bot@metabase.com>
2024-04-15 02:55:53 -03:00
Aleksandr Lesnenko
460d70c22a fix stacked series order (#40073) 2024-04-15 02:55:53 -03:00
Aleksandr Lesnenko
ef06ab7f38 fix interpolate missing values setting on stacked areas (#40041) 2024-04-15 02:55:53 -03:00
Aleksandr Lesnenko
ddd5f46bfb fix incorrect tooltip positioning on waterfall charts (#39973) 2024-04-15 02:55:53 -03:00
Aleksandr Lesnenko
63db418f7c Fix null ordinal value formatting (#39913)
* fix null ordinal value formatting

* specs

* undefined check
2024-04-15 02:55:53 -03:00
Aleksandr Lesnenko
0f2bef4a34 fix combined cards drills (#39816)
* fix combined cards drills

* tweak funnel bar and combined scalars
2024-04-15 02:55:53 -03:00
Emmad Usmani
df4bf34c3a remove hours of day waterfall story (#39960)
> [!IMPORTANT]
> If you are merging into master, please add either a `backport` or a `no-backport` label to this PR. You will not be able to merge until you do this step. Refer to the section [Do I need to backport this PR?](https://www.notion.so/metabase/Metabase-Branching-Strategy-6eb577d5f61142aa960a626d6bbdfeb3?pvs=4#89f80d6f17714a0198aeb66c0efd1b71) in the Metabase Branching Strategy document for more details.

> **Warning**
>
> If that is your first contribution to Metabase, please sign the [Contributor License Agreement](https://docs.google.com/a/metabase.com/forms/d/1oV38o7b9ONFSwuzwmERRMi9SYrhYeOrkbmNaq9pOJ_E/viewform) (unless it's a tiny documentation change). Also, if you're attempting to fix a translation issue, please submit your changes to our [POEditor project](https://poeditor.com/join/project/ynjQmwSsGh) instead of opening a PR.

Closes https://github.com/metabase/metabase/issues/[issue_number]

### Description

Describe the overall approach and the problem being solved.

### How to verify

Describe the steps to verify that the changes are working as expected.

1. New question -> Sample Dataset -> ...
2. ...

### Demo

_Upload a demo video or before/after screenshots if sensible or remove the section_

### Checklist

- [ ] Tests have been added/updated to cover changes in this PR
2024-04-15 02:55:53 -03:00
Aleksandr Lesnenko
8f6f44cf01 fix multiple merged timeline events icon is not star (#39876) 2024-04-15 02:55:53 -03:00
Aleksandr Lesnenko
c02514324f do not blur timeline events when series hovered (#39952) 2024-04-15 02:55:53 -03:00
Aleksandr Lesnenko
889d31c00d fix waterfall series is missing on enormous datasets (#39669)
* fix waterfall series is missing on enormous datasets

* specs
2024-04-15 02:55:53 -03:00
Emmad Usmani
3e442034cb fix missing placeholder series (#39278)
* fix missing placeholder series

* render correct display type
2024-04-15 02:55:53 -03:00
Aleksandr Lesnenko
0f7d0e0755 fix echarts layout and style (#39820)
* fix echarts layout

* update axis name font size & specs

* remove stacked totals data labels blur when series are hovered
2024-04-15 02:55:53 -03:00
Aleksandr Lesnenko
4604402621 reduce unnecessary debug logs (#39871) 2024-04-15 02:55:53 -03:00
Aleksandr Lesnenko
f518cd92bb patch echarts to support stacking on numeric scales (#39437)
* support stacking on numeric x-axes

* specs

* review

* specs
2024-04-15 02:55:51 -03:00
Emmad Usmani
dc7763e1d1 fix stacking in app (#39647) 2024-04-15 02:54:11 -03:00
Emmad Usmani
2d5cdfdab1 fix funnel bar breaking in app (#39484) 2024-04-15 02:54:11 -03:00
Emmad Usmani
085752e83a fix viz breaking when switching to funnel (#39365)
Closes https://github.com/metabase/metabase/issues/39276

### Description

Fixes the issue by correctly using `series` instead of `rawSeries` when rendering the placeholder.

### Demo

https://github.com/metabase/metabase/assets/37751258/59e39ad3-3a87-4e58-92cf-98d2a468b506

https://github.com/metabase/metabase/assets/37751258/e643fb56-c5e6-4865-81a5-6ec45d5e762f
2024-04-15 02:54:10 -03:00
Aleksandr Lesnenko
ef9ab3237f Improve time scale ticks behavior (#38911)
* handle time series ticks in ECharts

* fix waterfall total tick

* cleanup

* specs

* Update Loki Snapshots

* review

* compensate ticks timezone

* update snapshots

* spec

---------

Co-authored-by: Metabase bot <metabase-bot@metabase.com>
2024-04-15 02:54:08 -03:00
Emmad Usmani
164be53976 fix compact x-axis (#39230)
* fix compact x-axis

* Update Loki Snapshots

---------

Co-authored-by: Metabase bot <metabase-bot@metabase.com>
2024-04-15 02:53:50 -03:00
Emmad Usmani
f311b67241 add echarts error boundary
Closes https://github.com/metabase/metabase/issues/38881


### Description

Adds an error boundary to catch errors while rendering `CartesianChart`.

My original approach was to call `props.onRenderError` within the error boundary's `componentDidCatch` method, but for some reason it would not actually display the error message in in the `ErrorView` component that's used by `Visualization`, so I opted just to render `ErrorView` directly in the boundary instead.

### Demo

![Screenshot 2024-02-26 at 4.19.03 PM.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/9ULpbAzGBtvQRyZEpGvu/ed54547e-be2b-49c3-9b85-0da5ade46b40.png)


_Not sure how to test it in a prod environment_
2024-04-15 02:53:50 -03:00
Emmad Usmani
c8227fba41 fix cut off tick labels
Closes https://github.com/metabase/metabase/issues/37420

### Description

Fixes the issue by adding extra padding for long dimension labels.

### Demo


![Screenshot 2024-02-19 at 12.50.02 PM.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/9ULpbAzGBtvQRyZEpGvu/109e0176-54d8-4459-a0af-b69fe3148964.png)

![Screenshot 2024-02-19 at 12.50.20 PM.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/9ULpbAzGBtvQRyZEpGvu/234c3302-ceb7-4535-b75e-34d6058e5310.png)

250 label was cut off before

![Screenshot 2024-02-19 at 12.50.43 PM.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/9ULpbAzGBtvQRyZEpGvu/e2f17f83-bc66-4a39-a943-80602f835866.png)

last date was cut off before
### Checklist

- [x] Tests have been added/updated to cover changes in this PR
2024-04-15 02:53:50 -03:00
Emmad Usmani
70fa92bc01 reuse chartMeasurements computation
Part of https://github.com/metabase/metabase/issues/37420

### Description

Refactors the `chartMeasurements` computation to the component level, so we no compute it multiples times in different places.

Also makes `boundaryWidth` a property of `chartMeasuresments` as opposed to computing it in `timeline-events/model.ts`, so we can later re-use it to fix https://github.com/metabase/metabase/issues/37420

### Demo

![Screenshot 2024-02-13 at 11.27.05 AM.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/9ULpbAzGBtvQRyZEpGvu/2fdede7d-dde9-413e-8c0f-70aa0e673e9e.png)

Charts still render and timeline event bucketing still works

### Checklist

~~- [ ] Tests have been added/updated to cover changes in this PR~~
2024-04-15 02:53:50 -03:00
Aleksandr Lesnenko
e4997c5d70 upgrade echarts to 5.5.0 (#39189) 2024-04-15 02:53:48 -03:00
Emmad Usmani
e1ee1be79c fix combo stacking in static viz
Closes https://github.com/metabase/metabase/issues/38827

### Description

Fixes settings calculation, the `stack_type` setting should not be considered valid if it is non-null on a question where `card.display` is combo.

### Demo

![Screenshot 2024-02-20 at 2.25.58 PM.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/9ULpbAzGBtvQRyZEpGvu/92227610-a37c-455e-a827-ae0b32fc6a7c.png)

### Checklist

- [x] Tests have been added/updated to cover changes in this PR
2024-04-15 02:52:48 -03:00
Emmad Usmani
20841b1bf5 fix missing goal line label in static viz
Closes https://github.com/metabase/metabase/issues/38840

Fixes the issue by correcting the default viz setting computation in static viz.

![Screenshot 2024-02-20 at 1.51.57 PM.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/9ULpbAzGBtvQRyZEpGvu/65a16a64-9b20-49b2-ba3b-90367a49f78a.png)

- [x] Tests have been added/updated to cover changes in this PR

Covered by an existing loki test.
2024-04-15 02:52:48 -03:00
Emmad Usmani
984f12aaf0 fix goal line blur style (#38990)
Closes https://github.com/metabase/metabase/issues/38939

### Description

Adds a lower different opacity for the blur state for the scatter plot.

### Demo

![Screenshot 2024-02-20 at 3.00.17 PM.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/9ULpbAzGBtvQRyZEpGvu/2abbff5a-eb99-4042-a027-61f77d4b93ca.png)
2024-04-15 02:52:48 -03:00
Aleksandr Lesnenko
5dc14c359c Build waterfall chart with candlestick series and fix bugs (#37947)
* revamp the echarts implementation of waterfall to fix bugs

* use candlestick series for the waterfall, change the total label logic, define min interval for x-axis ticks, extract event handling code making it reusable

* fix relative date x-axis, fix pow, log y-axis

* fix waterfall Total tooltip, fix y-axis ticks overlap axis name, fix relative date time units

* reorganize waterfall code

* cleanup, add spec

* fix name of waterfall story

* reapply hover cursor fix

* fix negative zeros on y-axis power scale

* fix click events on waterfall, combo, and scatter charts

* pick correct dimension column for click event from data

* snapshots

* disable initial animation on the waterfall chart

* fixed waterfall bar widths when data has gaps, improve the total tick logic, address review feedback

* improve getTotalTimeSeriesXValue

* snapshots

* feedback

* fix z indices

* Update Loki Snapshots

---------

Co-authored-by: Metabase bot <metabase-bot@metabase.com>
2024-04-15 02:52:48 -03:00
Aleksandr Lesnenko
1ed578e2c3 Support all date buckets on waterfall charts (#37908)
* waterfall supports all time series units

* timeline events bucketing my unit for native questions

* snapshots

* x-axis key
2024-04-15 02:52:48 -03:00
Emmad Usmani
4bfcbc10b7 fix goal line under bar series (#38825)
* fix goal line under bar series

* add test

* Update Loki Snapshots

---------

Co-authored-by: Metabase bot <metabase-bot@metabase.com>
2024-04-15 02:52:48 -03:00
Emmad Usmani
d784178cfb improve bubble size scaling (#38623)
* improve bubble size scaling

* Update Loki Snapshots

---------

Co-authored-by: Metabase bot <metabase-bot@metabase.com>
2024-04-15 02:52:48 -03:00
Emmad Usmani
702feb54df fix goal line fading (#38580)
* fix goal line fading

* fix dot opacity

* fix single series case
2024-04-15 02:52:48 -03:00
Emmad Usmani
5bc4a29aa6 fix error with fully null series (#38576)
* fix error with fully null series

* add tests

* Update Loki Snapshots

---------

Co-authored-by: Metabase bot <metabase-bot@metabase.com>
2024-04-15 02:52:48 -03:00
Emmad Usmani
942457ee45 add test for scatter plot breakout bubble size (#38571)
* add test for scatter plot breakout bubble size

* Update Loki Snapshots

---------

Co-authored-by: Metabase bot <metabase-bot@metabase.com>
2024-04-15 02:52:48 -03:00
Emmad Usmani
049150e3cd fix storybook text alignment (#38569)
* fix storybook text alignment

* update loki references manually to fix conflict
2024-04-15 02:52:48 -03:00
Emmad Usmani
08846f041c fix histogram bar width (#38534)
* fix histogram bar width

* add tests

* Update Loki Snapshots

---------

Co-authored-by: Metabase bot <metabase-bot@metabase.com>
2024-04-15 02:52:48 -03:00
Emmad Usmani
81465b942d fix reversed stacking order (#38495)
* fix reversed stacking order

* only reverse series if it is stacked

* manually update loki images
2024-04-15 02:52:48 -03:00
Emmad Usmani
c85925b95c fix goal line out of bounds (#38493)
* fix goal line out of bounds

* add test

* fix range being affected by disabled goal line

* Update Loki Snapshots

* revert axis range changes, use goal line data instead

* add tests

* whitespace

* trigger loki update

* Update Loki Snapshots

---------

Co-authored-by: Metabase bot <metabase-bot@metabase.com>
2024-04-15 02:52:48 -03:00
Emmad Usmani
83c84d9f1b fix trend line zlevel bug (#38494)
* fix trend line zlevel bug

* Update Loki Snapshots

---------

Co-authored-by: Metabase bot <metabase-bot@metabase.com>
2024-04-15 02:52:48 -03:00
Aleksandr Lesnenko
4210de1250 Use constant x-axis dataKey and fix dataset unit specs (#38452)
* Use constant x-axis dataKey and fix dataset unit specs

* fix scatter dataset creation
2024-04-15 02:52:48 -03:00
Aleksandr Lesnenko
7ed11ee7f6 Fix missing tooltip on line and area charts when the symbol is hidden (#38438) 2024-04-15 02:52:48 -03:00
Aleksandr Lesnenko
403c841d64 Fix hover cursor is always crosshair instead of pointer on brushable charts (#38440) 2024-04-15 02:52:48 -03:00
Aleksandr Lesnenko
b3b48ec15d fix loki workflow 2024-04-15 02:52:48 -03:00
Emmad Usmani
a64051ef3e fix normalized stacked bars extra space (#37926)
* fix normalized stacked bars extra space

* fix static viz setting

* add test

* Update Loki Snapshots

---------

Co-authored-by: Metabase bot <metabase-bot@metabase.com>
2024-04-15 02:52:48 -03:00
Aleksandr Lesnenko
9f3c25526d Try fixing loki flakiness, fix waterfall does not render (#37901)
* Try fixing loki flakiness, fix waterfall does not render

* update ci workflow

* update snapshots

* bump tolerance
2024-04-15 02:52:46 -03:00
Emmad Usmani
a4c236b50b fix doubled dimension values (#37871)
* fix doubled dimension values

* add visual test reproduction

* fix typo
2024-04-15 02:52:00 -03:00
Aleksandr Lesnenko
5cf3b58d80 fix missing sign on negative ticks on pow scale (#37680)
* fix missing sign on negative ticks on pow scale

* add story
2024-04-15 02:52:00 -03:00
Aleksandr Lesnenko
87ae889442 remove initial slow animation & lags (#37847)
* remove initial slow animation

* fix visual lags caused by not effectively memoizing the option object
2024-04-15 02:52:00 -03:00
Emmad Usmani
12579dc71d fix line series dots (#37842)
* fix line series dots

* add tests

* update hook

* Update Loki Snapshots

---------

Co-authored-by: Metabase bot <metabase-bot@metabase.com>
2024-04-15 02:52:00 -03:00
Emmad Usmani
ac1bcca3f0 add chart debugger hook (#37843) 2024-04-15 02:52:00 -03:00
Aleksandr Lesnenko
2b1cc5b504 Patch zrender until a new version is released (#37835) 2024-04-15 02:51:58 -03:00
Aleksandr Lesnenko
15392306b3 fix two y-axis each render splitlines (#37834)
* fix two y-axis each render splitlines [ci skip]

* snapshots
2024-04-15 02:50:41 -03:00
Aleksandr Lesnenko
0d8f9fd70e fix wrong visualization setting key format when combining cards on a dashboard (#37772)
* fix wrong visualization setting key format when combining cards on a dashboard

* update snapshots [ci skip]
2024-04-15 02:50:41 -03:00
Aleksandr Lesnenko
c1552821f4 Add static funnel bar and combined scalars charts (#37621)
* Add static funnel bar and combined scalars charts

* update snapshots [ci skip]
2024-04-15 02:50:41 -03:00
Aleksandr Lesnenko
ff51e62e91 ECharts funnel bar chart (#37489)
* Use ECharts for funnel bar chart

* Use ECharts for funnel bar

* Use ECharts for funnel bar: convert the funnel viz to TS, update settings
[ci skip]
2024-04-15 02:50:41 -03:00
Aleksandr Lesnenko
907db57f75 ECharts combined scalars chart (#37142)
* Use ECharts for combined scalars

* update visual specs with a small fix of stacked labels required to pass

* update snapshots
2024-04-15 02:50:39 -03:00
Aleksandr Lesnenko
722f0682f8 fix missing waterfall labels due to changed signature while merging different stacks 2024-04-15 02:49:59 -03:00
Aleksandr Lesnenko
c22e961d48 fix stacked bars and areas labels not showing total, fix positioning of negative bar labels (#37721)
* fix stacked bars and areas labels not showing total, fix positioning of negative bar labels

* review
2024-04-15 02:49:59 -03:00
Aleksandr Lesnenko
80fc49e182 build uberjars from echarts branch 2024-04-15 02:49:59 -03:00
Emmad Usmani
79854a95ee remove BE waterfall code (#37543)
* remove BE waterfall code

* removed func from js_svg
2024-04-15 02:49:59 -03:00
Emmad Usmani
ae5f2fd6c3 fix timeseries error [ci skip] (#37538) 2024-04-15 02:49:59 -03:00
Emmad Usmani
4af54a5a80 waterfall handle nulls (#37488)
* handle nulls [ci skip]

* use NULL_DISPLAY_VALUE instead of string
2024-04-15 02:49:59 -03:00
Emmad Usmani
275c900617 fix total events [ci skip] (#37487) 2024-04-15 02:49:59 -03:00
Emmad Usmani
1d08846581 dynamic waterfall (#37486)
* dynamic waterfall

* fix timeline event click [ci skip]
2024-04-15 02:49:59 -03:00
Aleksandr Lesnenko
97f59298b4 setup loki visual testing for echarts (#37776)
* setup loki visual testing for echarts

* Update Loki Snapshots
2024-04-15 02:49:57 -03:00
Aleksandr Lesnenko
c7ebfe51e8 fix unsorted x-axis (#37673)
* fix unsorted x-axis

* spec

* split sorting and transforming
2024-04-15 02:49:27 -03:00
Aleksandr Lesnenko
ca1345606c fix charts brushing broken due to usage of mlv2 query (#37728) 2024-04-15 02:49:27 -03:00
Aleksandr Lesnenko
4f33fd80e7 fix icons import 2024-04-15 02:49:27 -03:00
Aleksandr Lesnenko
424e754ba3 fix yarn.lock 2024-04-15 02:49:24 -03:00
Emmad Usmani
82e01af7c3 fix icon import (#37603) 2024-04-15 02:48:48 -03:00
Emmad Usmani
283cf06f09 remove old static waterfall code [ci skip] (#37282) 2024-04-15 02:48:48 -03:00
Emmad Usmani
0b1b8e4a07 use constant for empty val [ci skip] (#37277) 2024-04-15 02:48:48 -03:00
Emmad Usmani
e269ca7792 remove unused extent calculation [ci skip] (#37276) 2024-04-15 02:48:48 -03:00
Emmad Usmani
3284f3d937 waterfall power y-axis scale (#37247)
* add storybook example

* implement data transformation

* update storybook example

* fix total calculation and data label

* negative storybook example

* handle negatives

* handle negatives, data labels, axis labels

* add another storybook example

* fix negative data label

* fix axis labels for negative values

* improve comment [ci skip]
2024-04-15 02:48:48 -03:00
Emmad Usmani
8abf10866e waterfall data labels (#37063)
* add basic storybook example

* implement setting

* add column formatting story

* add timeseries story

* add mixed positive/negative story

* handle negatives [ci skip]
2024-04-15 02:48:48 -03:00
Emmad Usmani
6a6c53f61e waterfall total (#36961)
* total bar

* add storybook examples

* handle timeseries [ci skip]
2024-04-15 02:48:48 -03:00
Emmad Usmani
b272216f91 waterfall color setting (#36957)
* add storybook example

* implement series colors

* implement default settings [ci skip]
2024-04-15 02:48:48 -03:00
Emmad Usmani
2e66933712 waterfall handle unaggregated data (#36926)
* storybook examples [ci skip]

* handle unaggregated data [ci skip]
2024-04-15 02:48:48 -03:00
Emmad Usmani
fe96c4b75a rename 'dataset' to 'waterfallDataset' [ci skip] (#36925) 2024-04-15 02:48:48 -03:00
Emmad Usmani
e01f90a501 handle unsorted timeseries data (#36888)
* handle unsorted timeseries data [ci skip]

* add storybook example [ci skip]
2024-04-15 02:48:48 -03:00
Emmad Usmani
3ac61c059c waterfall handle negatives (#36887)
* handle negatives [ci skip]

* add 'mixed above 0' example

* add more storybook examples

* negative handling logic

* refactoring

* rename translationConstant -> negativeTranslation [ci skip]
2024-04-15 02:48:48 -03:00
Emmad Usmani
cea0287626 waterfall axis options (#36886)
* y-axis option [ci skip]

* handle x-axis type

* add stories [ci skip]
2024-04-15 02:48:48 -03:00
Emmad Usmani
9b1c068c19 render waterfall series (#36728)
* create chart model [ci skip]

* create option

* add new args for getCartesianChartOption [ci skip]
2024-04-15 02:48:48 -03:00
Emmad Usmani
cd52610343 setup rendering pipeline for echarts static waterfall (#36621)
* setup BE pipeline & render placeholder [ci skip]

* setup FE rendering pipeline with mock bar series

* storybook examples

* rename story

* remove legend code

* add new params to getCartesianChartOption [ci skip]
2024-04-15 02:48:48 -03:00
Aleksandr Lesnenko
f1eb4b3925 Add dynamic scatter plot (#37143)
[ci skip]
2024-04-15 02:48:48 -03:00
Aleksandr Lesnenko
ee508d73c0 disable static charts animation (#37094) 2024-04-15 02:48:48 -03:00
Aleksandr Lesnenko
fd4e26f5ee support hovers and clicks on timeline events (#37064) 2024-04-15 02:48:48 -03:00
Aleksandr Lesnenko
1474c2491c support timeline events on the new combo chart (#36879) 2024-04-15 02:48:48 -03:00
Aleksandr Lesnenko
390890b0d9 polish dynamic combo chart (#36878) 2024-04-15 02:48:48 -03:00
Aleksandr Lesnenko
99cd723e56 support brushing on the combo echart (#36779) 2024-04-15 02:48:48 -03:00
Aleksandr Lesnenko
d2c24493fe Add tooltip and stacked tooltips support to the dynamic combo chart (#36729) 2024-04-15 02:48:48 -03:00
Aleksandr Lesnenko
53c915c09c Support click behavior (#36563) 2024-04-15 02:48:48 -03:00
Aleksandr Lesnenko
10381f86ca replace dc.js line/area/bar/combo charts with newer echarts implementation (#36135) 2024-04-15 02:48:48 -03:00
Emmad Usmani
e1530a65f8 fix visible y-axis line (#36781)
* fix visible y-axis line

* add storybook examples
2024-04-15 02:48:48 -03:00
Emmad Usmani
e7dfd66254 scatter add pow x-scale multi-series story (#36884) 2024-04-15 02:48:48 -03:00
Emmad Usmani
841a98ef89 scatter fix log x-axis bug (#36883) 2024-04-15 02:48:48 -03:00
Emmad Usmani
04a0342dc3 scatter custom y-axis range story (#36882) 2024-04-15 02:48:48 -03:00
Emmad Usmani
adc0f9dde9 fix goal line on scatter plot (#36564)
* fix goal line on scatter plot

* add slient option to prevent mouse events

* use empty data array
2024-04-15 02:48:48 -03:00
Emmad Usmani
db32b00b8d bubble size for scatter plot (#36548)
* bubble size for scatter plot

* comment

* update default bubble size

* add storybook example

* remove extra comments

* remove another extra comment

* refactor default column code

* fix typo in comment

* reword comment
2024-04-15 02:48:48 -03:00
Emmad Usmani
a34b48d7ca pow x-axis scale scatter plot (#36560) 2024-04-15 02:48:48 -03:00
Emmad Usmani
11f2fec233 log x-axis for scatter plot (#36510) 2024-04-15 02:48:48 -03:00
Emmad Usmani
fde350029f series breakout for scatter plot (#36502)
* series breakout for scatter plot

* remove unused eslint-disable

* remove duplicate keys in breakout
2024-04-15 02:48:48 -03:00
Emmad Usmani
86325ac9b2 create static scatter plot with echarts (#36317)
* create static scatter plot with echarts

* add storybook examples

* add multi metric series story

* separate dataset computation

* remove hacky default x-axis scale calculation

* remove comment

* improve file structure

* styles

* remove unused `settings` param from series computation

* remove unused export

* remove `scatter2`

* remove redundant animation disable

* remove extra comment
2024-04-15 02:48:48 -03:00
Aleksandr Lesnenko
39f51b6063 fix broken stacking (#36506) 2024-04-15 02:48:47 -03:00
Emmad Usmani
b30e2d8fae remove duplicate function (#36486) 2024-04-15 02:48:47 -03:00
Emmad Usmani
97ef2b2e57 combo chart trend line (#35997)
* combo chart trend line

* support combining cards

* add support for normalized stacked bars

* add styles

* update `datasetIndex` offset after rebase

* add support for power scale

* clean up code

* add jsdoc comments

* add storybook examples

* add better logic to determine when to normalize

* small fixes

* add `yAxisIndex` to trend line
2024-04-15 02:48:47 -03:00
Emmad Usmani
9e17aede23 combo chart goal line (#35345)
* combo chart goal line

* refactor to separate function

* fix type error

* remove comment

* handle goal line setting disabled

* handle y-axis split

* improve variable names
2024-04-15 02:48:47 -03:00
Aleksandr Lesnenko
f482e510cc Fix combined cards with dimensions that have different units (#36013) 2024-04-15 02:48:47 -03:00
Aleksandr Lesnenko
b987224d2a fix charts broken when there is right y-axis only (#35923) 2024-04-15 02:48:47 -03:00
Aleksandr Lesnenko
aa4675baf5 Support histogram X-axis, improve X-axis type inferrence (#35922) 2024-04-15 02:48:47 -03:00
Aleksandr Lesnenko
1f51c8854a Support linear, log, pow Y-axis scales (#35783) 2024-04-15 02:48:47 -03:00
Aleksandr Lesnenko
d3bf66f1c1 Align combo chart ticks, axes names (#35573)
* support axes display settings, axes labels, pass own measureText function to echarts

* support axes display settings, axes labels, pass own measureText function to echarts

* support axes display settings, axes labels, pass own measureText function to echarts
2024-04-15 02:48:47 -03:00
Aleksandr Lesnenko
2fa31b5b11 support custom y-axis range (#35395) 2024-04-15 02:48:47 -03:00
Aleksandr Lesnenko
394788d750 add legend to the static combo chart (#35321)
* add legend to the static combo chart

* add legend to the static combo chart

* add legend to the static combo chart
2024-04-15 02:48:47 -03:00
Aleksandr Lesnenko
15b602563b Support Y-axis split (#35307) 2024-04-15 02:48:47 -03:00
Aleksandr Lesnenko
6a3bf57c5c Support normalized stacking (#35304) 2024-04-15 02:48:47 -03:00
Aleksandr Lesnenko
3fe637b2dc Support replacing nulls with zeros (#35303) 2024-04-15 02:48:47 -03:00
Aleksandr Lesnenko
90c511d3c3 apply breakout series sorting (#35301)
* apply breakout series sorting

* apply breakout series sorting
2024-04-15 02:48:47 -03:00
Aleksandr Lesnenko
72ae51984f add basic static combo chart built with echarts (#35300)
* add basic static combo chart built with echarts

* review fixes
2024-04-15 02:48:47 -03:00
Aleksandr Lesnenko
9bbeae1120 update cartesian chart columns utils and types (#35297) 2024-04-15 02:48:47 -03:00
Aleksandr Lesnenko
e8470643a6 create unified BE path for isomorphic visualizations (#34820)
* remove old line/area/bar/combo charts paths

* include dashcard viz settings into default computation

* fix `getCommonStaticVizSettings`

* Removing some more failing tests.

These tests are tracked and will be re-added appropriately as the isomorphic chart development continues.

* Isomorphic timeline events viz 34924 (#35619)

* Initial states of isomorphic line charts/events for BE

Initial stages of getting line charts, with a focus towards timeline events,
rendered using the isomorphic pipeline. This change handles cases where a
card has multiple breakouts, forming multiple timelines, vs. a dashcard, which
may have both a query and series to establish multiple timelines.

* Timeline events passed to :isomorphic chart type

Timeline events are now grabbed for the card(s) and passed into the static-viz rendering pipeline.

This commit adds:

 - `dashcard-timeline-events` helper fn that gets events for every timeline in the Collection that the card is part
 of.
 - adjustments to the `execute-multi-card` function for the situation where it's called with `nil`
 dashcard-or-id.
   - This function may need to be re-visited as the isomorphic chart work continues (namely, we need to make sure
 this function works correctly for all scenarios 1. single card 2. single card with multiple series (a 'combo' chart)
 3. dashcard with multiple single series visualized on one card and 4. dashcard with mixed single/multi-series
 cards (not sure if this last one is possible).
 - a test to ensure timeline events are added

---------

Co-authored-by: Adam James <adam.vermeer2@gmail.com>

---------

Co-authored-by: Emmad Usmani <emmadusmani@berkeley.edu>
Co-authored-by: Adam James <adam.vermeer2@gmail.com>
Co-authored-by: Mark Bastian <markbastian@gmail.com>
2024-04-15 02:48:44 -03:00
Emmad Usmani
167bf39215 add dominant-baseline workaround for echarts (#35118)
* add dominant-baseline workaround

* patch nodes recursively

* add test
2024-04-15 02:47:10 -03:00
Aleksandr Lesnenko
3032d4c1f5 add echarts renderer component (#34606)
* add echarts renderer component

* transform svg for static viz

* rendering context

* update webpack config for the static viz bundle

* fix type errors in `StaticChart.tsx`

* fix bug introduced while fixing types

* make event handlers in EChartRenderer optional

* common static viz settings, update series types

* fix `ComputedVisualizationSettings` type and `getColumnSettings`

---------

Co-authored-by: Emmad Usmani <emmadusmani@berkeley.edu>
2024-04-15 02:24:48 -03:00
573 changed files with 316908 additions and 18766 deletions

73
.github/workflows/loki-update.yml vendored Normal file
View File

@@ -0,0 +1,73 @@
name: Update Loki Snapshots
on:
pull_request:
types: [labeled]
jobs:
check-label-and-update-snapshot:
if: contains(github.event.pull_request.labels.*.name, 'loki-update')
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
- name: Prepare frontend environment
uses: ./.github/actions/prepare-frontend
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: "cljs"
- name: Compile CLJS
run: yarn build-pure:cljs
- name: Build Storybook
run: yarn build-storybook
- name: Serve Storybook
run: yarn http-server storybook-static -p 6006 &
shell: bash
- name: Wait for Storybook to become available
run: |
echo "Waiting for Storybook to be served..."
while ! curl --silent --fail http://localhost:6006; do
sleep 5
echo "Retrying..."
done
echo "Storybook is being served!"
- name: Update Loki Snapshots
run: yarn test-visual:loki-update
- uses: tibdex/github-app-token@v2.1.0
id: generate-token
with:
app_id: ${{ secrets.METABASE_BOT_APP_ID }}
private_key: ${{ secrets.METABASE_BOT_APP_PRIVATE_KEY }}
- name: Commit and Push Changes
run: |
git config --global user.name "Metabase bot"
git config --global user.email "metabase-bot@metabase.com"
git add .loki/**
git commit -m "Update Loki Snapshots"
git push
env:
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
- name: Post Comment
uses: actions/github-script@v3
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: "Snapshots have been updated"
})

80
.github/workflows/loki.yml vendored Normal file
View File

@@ -0,0 +1,80 @@
name: Loki Visual Regression Testing
on: [pull_request]
jobs:
visual-test:
runs-on: ubuntu-latest
services:
docker:
image: docker:19.03.12
options: --privileged
ports:
- 2376:2376
env:
DOCKER_TLS_CERTDIR: /certs
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /tmp/docker-certs:/certs/client
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Prepare frontend environment
uses: ./.github/actions/prepare-frontend
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: "cljs"
- name: Compile CLJS
run: yarn build-pure:cljs
- name: Build Storybook
run: yarn build-storybook
- name: Serve Storybook
run: yarn http-server storybook-static -p 6006 &
shell: bash
- name: Wait for Storybook to become available
run: |
echo "Waiting for Storybook to be served..."
while ! curl --silent --fail http://localhost:6006; do
sleep 5
echo "Retrying..."
done
echo "Storybook is being served!"
- name: Run Loki Visual Tests
run: |
yarn loki test
- name: Generate Visual Report on Failure
if: failure()
run: yarn test-visual:loki-report
- name: Upload Artifact
if: failure()
uses: actions/upload-artifact@v3
with:
name: loki-report
path: .loki/
if-no-files-found: ignore
- name: Post Comment with Report Link
if: failure()
uses: actions/github-script@v3
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const runUrl = `https://github.com/metabase/metabase/actions/runs/${{ github.run_id }}`
const comment = `🚨 Visual Regression Tests failed. Get the [report artifact](${runUrl})`
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment
})

View File

@@ -4,6 +4,7 @@ on:
push:
branches:
- "master"
- "echarts"
paths-ignore:
# config files
- ".**"

4
.loki/.gitignore vendored Normal file
View File

@@ -0,0 +1,4 @@
current
difference
report.html
report.json

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Some files were not shown because too many files have changed in this diff Show More