Skip to content

Support Unicode in class names #665

@sineed

Description

@sineed

Hi! First of all I want to say big thanks to @masayuki0812. This is a great plugin, good work!

I came with a small problem. In my project a have a chart that has a legend with cyrillic names. For example, мужчины (men, eng.) and женщины (women, eng.). Both words have seven chars.
The problem is that the function getTargetSelectorSuffix returns the same for both strings: --------. And it becomes the reason of some bugs. What I want is -мужчины and -женщины instead.

If someone had the same problem, a have a WA (note: it works only in 0.3.0 version):

  c3.chart.internal.fn.getTargetSelectorSuffix = function(targetId) {
    if (targetId || targetId === 0) {
      targetId = targetId.replace ? targetId.replace(/[^\w\u0400-\u04FF-]/g, '-') : targetId;
      return '-' + targetId;
    } else {
      return '';
    }
  };

I have changed only regexp, the rest is style changes. With this patch cyrillic symbols aren't replaced by hyphen.

I have a question: are you plan to support Unicode characters in class names? If so, it will fix my problem. I guess, that it's right to have unicode in css identifiers (see this).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions