Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
280 views
in Technique[技术] by (71.8m points)

Highcharts: Rerendering a plotline removes all styling

I draw a plotline with the current time to visualize to the user where hes at currently. The date range is up to the user and if he selects a date range above a week he will see data in a daily resolution. I want to remove the "current-time"-plotline for that. Unfortunatly, when the user comes back into the a date range smaller than a week the plotline reappears but without any styling, its just a grey line. I suspect this is a bug in the highcharts library. Anything I can do about that?

This is my code where I trigger the plotline conditionally on the resolution:

plotLines: isLessOrEqualDailyResolution
              ? [
                  {
                    ...(chartOptions.xAxis as XAxisOptions).plotLines![0],
                    value: new Date().getTime(),
                    label: {
                      text: format(new Date(), 'H:mm'),
                      rotation: 0,
                      verticalAlign: 'bottom',
                      align: 'center',
                      style: {
                        transform: 'translate(-4px, 25px)',
                        color: theme.palette.info.main,
                        fontWeight: 'bold',
                      },
                    },
                  },
                ]
              : [],

Correct styling Bad styling after reappearance


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...