dosubot[bot] commented on issue #30347:
URL: https://github.com/apache/superset/issues/30347#issuecomment-2363474851

   <!-- Greeting -->
   @martyngigg Hello! I'm here to help you with any bugs, questions, or 
contributions. Let's get this sorted out together!
   
   <!-- Answer -->
   I found a similar closed issue: [Line Chart annotations don't load on 
Time-Series Line Charts](https://github.com/apache/superset/issues/21694). 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 
<sup>[[1]](https://github.com/apache/superset/issues/21694)</sup>.
   
   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:
   
   ```js
   // 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 
<sup>[[2]](https://github.com/apache/superset/blob/master/superset-frontend/plugins/legacy-preset-chart-nvd3/src/NVD3Vis.js)</sup><sup>[[3]](https://github.com/apache/superset/blob/master/superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/transformProps.test.ts)</sup><sup>[[4]](https://github.com/apache/superset/blob/master/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformers.ts)</sup>.
   
   
   <!-- Dosu Comment Footer -->
   *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org
For additional commands, e-mail: notifications-h...@superset.apache.org

Reply via email to