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

Default on canvas legend callback should also get data from config #2281

Closed
etimberg opened this issue Apr 17, 2016 · 0 comments · Fixed by #5621
Closed

Default on canvas legend callback should also get data from config #2281

etimberg opened this issue Apr 17, 2016 · 0 comments · Fixed by #5621
Milestone

Comments

@etimberg
Copy link
Member

The default legend callback, reproduced below, should fallback to the values in the config if possible.

generateLabels: function(data) {
  return helpers.isArray(data.datasets) ? data.datasets.map(function(dataset, i) {
    return {
      text: dataset.label,
      fillStyle: dataset.backgroundColor,
      hidden: dataset.hidden,
      lineCap: dataset.borderCapStyle,
      lineDash: dataset.borderDash,
      lineDashOffset: dataset.borderDashOffset,
      lineJoin: dataset.borderJoinStyle,
      lineWidth: dataset.borderWidth,
      strokeStyle: dataset.borderColor,
      // Below is extra data used for toggling the datasets
      datasetIndex: i
    };
  }, this) : [];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants