Skip to content

CanvasPattern object loses type information in chart-dataset-override directive. #548

@jgoakley

Description

@jgoakley

Chart.JS was recently updated to support CanvasPattern objects as the background color to allow for using patterns as well as colors for their chart data.

I tried to pass in a CanvasPattern as the backgroundColor using the chart-dataset-override directive. When angular-chart.js uses angular.merge, the CanvasPattern object loses it's type information. As a result, when Chart.JS performs an instanceof CanvasPattern it does not match object's type and results in a Unable to parse color from object {} error and the patterns are not shown.

I'm not sure if this will be an acceptable fix, but using angular.extend instead of angular.merge seemed to carry over the type information. I know that merge performs a deep copy and extend does not so I'm not sure what the implications will be.

Here is a link to a fiddle: https://jsfiddle.net/jgoakley/peqcgudy/23/

Pull Request: #549

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions