Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fully transparent spaces between dashes #6

Open
Johny12369 opened this issue Nov 28, 2019 · 2 comments
Open

Fully transparent spaces between dashes #6

Johny12369 opened this issue Nov 28, 2019 · 2 comments

Comments

@Johny12369
Copy link

Hello, first of all thanks a lot for the plugin.
Is it possible to make fully transparent spaces between dashes? I have colored line with applied dashes on it but in the result the spaces between dashes are not fully transparent. Spaces are just lighter color of the same color as dashes.

Thanks

@7PH
Copy link

7PH commented Dec 9, 2021

Hi @Johny12369

This is due to the line still being drawn by flot after the dashes plugin drew them already.

You can fix this by adding a hook with lowest priority to drawSeries:

/**
 * Avoid drawing the dashed lines of the "dash" plugin.
 */
plot.hooks.drawSeries.push((plot, canvascontext, series) => {
    if (series.dashes && series.dashes.show) {
        series.datapoints.points = [];
    }
});

@7PH
Copy link

7PH commented Dec 9, 2021

Actually, I found out that it's now supported in FlotChart. You can set the "dashes" property in series[i].line:
https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/setLineDash
https://github.com/flot/flot/blob/d0f569a47566c61ef7a43e94e5daaacd1a18bf4e/source/jquery.flot.drawSeries.js#L345

As a result, I will be dropping this plugin from our dependencies

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants