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

Series-name with parenthesis causes exception on toggleSeries() #355

Closed
paaaz opened this issue Feb 27, 2019 · 1 comment
Closed

Series-name with parenthesis causes exception on toggleSeries() #355

paaaz opened this issue Feb 27, 2019 · 1 comment
Labels
bug Something isn't working

Comments

@paaaz
Copy link

paaaz commented Feb 27, 2019

Codepen

https://codepen.io/anon/pen/LaVRVY

Explanation

  • What is the behavior you expect?
    That the name of a series is unconstrained and toggling works with chart.toggleSeries(name)

  • What is happening instead?
    Exception raises:

  • What error message are you getting?
    Uncaught DOMException: Failed to execute 'querySelector' on 'Element': '.apexcharts-series.(250)-Errorous-Name' is not a valid selector. at t.value (https://cdn.jsdelivr.net/npm/apexcharts:6:162051) at i.value (https://cdn.jsdelivr.net/npm/apexcharts:6:408022) at toggleError (pen.js:62:11) at HTMLButtonElement.onclick (https://s.codepen.io/boomerang/iFrameKey-d5b12e0e-22b3-e6b3-f495-289f92142d77/index.html:13:55)

Temporary Fix

I think the name should be generally escaped somehow, I could fix the bug temporary for my case with parenthesis with adding replace functions.

(Line 11364 in v3.3.0)
key: "getSeriesByName", value: function getSeriesByName(seriesName) { return this.w.globals.dom.baseEl.querySelector(".apexcharts-series.".concat(seriesName.toString().replace(/ /g, '-').replace(/\(/g, '\\(').replace(/\)/g, '\\)'))); }

@junedchhipa junedchhipa added the bug Something isn't working label Feb 27, 2019
@junedchhipa
Copy link
Contributor

Fixed in this commit - e7f3b7d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants