Closed martyngigg closed 1 week ago
@martyngigg Hello! I'm here to help you with any bugs, questions, or contributions. Let's get this sorted out together!
I found a similar closed issue: Line Chart annotations don't load on Time-Series Line Charts. The issue was fixed on the master
branch and will be included in the upcoming 2.1.0 and/or 3.0 releases. If needed, the fix can be isolated to a single PR and applied to version 2.0.2 by making a request on the specified thread [1].
The interval annotations on line charts are not appearing in the master version of Apache Superset because the code responsible for updating the annotation positions on brush events is missing in the master version. This code is present in the 4.02-dev and 4.1.0rc2-dev versions. The following snippet is responsible for updating the interval annotations on brush events:
// update annotation positions on brush event
if (chart.focus) {
chart.focus.dispatch.on('onBrush.interval-annotation', () => {
annotations
.selectAll('rect')
.data(records)
.attr({
x: d => xScale(new Date(d[e.timeColumn])),
width: d => {
const x1 = xScale(new Date(d[e.timeColumn]));
const x2 = xScale(new Date(d[e.intervalEndColumn]));
return Math.max(Math.abs(x2 - x1), 1);
},
});
});
}
Additionally, the transformProps
function in the Timeseries
plugin for Echarts in Apache Superset is responsible for transforming the chart properties, including annotations. The test cases for transformProps
show that interval annotations are expected to be included in the transformed properties. If the interval annotations are not appearing, it could be due to a missing or incorrect implementation in the transformProps
function in the master version [2][3][4].
To continue talking to Dosu, mention @dosu.
@martyngigg https://github.com/apache/superset/pull/30348 should have fixed the bug. Closing this issue, feel free to reopen if the bug persists
@kgabryje Yep looks good in my example now. Thanks!
Bug description
Annotation layers of type "Interval" no longer seem to appear on line charts in master. They are fine in 4.02-dev and 4.1.0rc2-dev but not on master.
It does not matter if the source is a 'Superset annotation' or a 'Table'.
How to reproduce the bug
This uses the examples datasets.
TAG=994de1f-dev docker compose -f ./docker-compose-image-tag.yml up -d
+ Annotation layer
buttonAdd
+ Annotation
button2000-01-01 00:00:00
and end date to2004-01-01 00:00:00
Add
Charts
in the navigation bar+ Chart
birth_names
datasetLine Chart
typeCreate new chart
ds
column toX-axis
num
column toMetrics
, choose the Sum aggregate and clickSave
Annotations and Layers
followed by+ Add annotation layer
Show label
boxAnnotation layer type
toInterval
Annotation source
toSuperset annotation
Annotation layer
to the name given to the newly created layer in step 2Update chart
I cannot see any errors in the superset logs. I've attached a screenshot of an error in the Firefox console.
Screenshots/recordings
Superset version
master / latest-dev
Python version
3.10
Node version
18 or greater
Browser
Firefox
Additional context
No response
Checklist