GitHub user ersandemir closed a discussion: Superset Line Chart  line witdh 
resize

Hi Superset Team,

I'm working on a custom ECharts-based timeseries chart plugin 
(plugin-chart-custom-line) and trying to allow users to control the 
lineStyle.width dynamically through a SliderControl.

What I did:
I created a custom plugin by copying the default ECharts Timeseries chart.

I added a SliderControl named lineWidth in controlPanel.tsx:

{
  name: 'lineWidth',
  config: {
    type: 'SliderControl',
    label: t('Line Width'),
    default: 2,
    min: 1,
    max: 10,
    step: 1,
    renderTrigger: true,
    description: t('Adjust the width of the line.'),
  },
}
I confirmed that the slider value is available in formData by logging 
formData.lineWidth inside transformProps.ts.

The transformed series is generated via transformSeries() from transformers.ts.

In transformers.ts, I modified the lineStyle as follows:

lineStyle: {
  width: formData.lineWidth ?? 2,
},

The problem:
Despite updating the lineStyle.width dynamically from the SliderControl, the 
rendered chart does not reflect the new line width when the slider is changed.

Things I verified:
formData.lineWidth does receive the updated value on slider change.
renderTrigger: true is correctly set on the slider control.
I manually tested with a static value (e.g., width: 10) and it works β€” so the 
config is applied, just not dynamically.

πŸ” Suspected issue:
It seems the updated echartOptions are being passed, but Echart.setOption() 
might not fully re-render the series line style unless deep changes are 
detected.

❓What I'm asking:
Is there anything additional I need to do to force a full re-render of the 
chart when a visual property like lineStyle.width changes?

Is there a preferred way in Superset custom plugins to reflect style changes 
like this via SliderControl?

Should I force-refresh the chart in some specific lifecycle method?

πŸ“‚ Folder structure reference:

plugin-chart-custom-line/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ Timeseries/
β”‚   β”‚   β”œβ”€β”€ Regular/
β”‚   β”‚   β”‚   β”œβ”€β”€ Line/
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ controlPanel.tsx  ← Slider added here
β”‚   β”‚   β”œβ”€β”€ transformers.ts           ← lineStyle updated here
β”‚   β”‚   β”œβ”€β”€ transformProps.ts         ← calls transformSeries()
β”‚   β”‚   β”œβ”€β”€ EchartsTimeseries.tsx     ← uses echartOptions from transformProps
Any help or guidance would be greatly appreciated πŸ™
Thanks in advance for your great work!
@sudo

<img width="408" height="392" alt="image" 
src="https://github.com/user-attachments/assets/be78a4fc-bcba-43d2-9203-8c17583ca893";
 />


GitHub link: https://github.com/apache/superset/discussions/34223

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: 
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to