Skip to content

Chart should have a reference to itself. #2483

@shlomiassaf

Description

@shlomiassaf

When using CommonJS with ES6 modules syntax (Babel, TypeScript...) there is limited support for import statements.

It is only possible to load a reference to the Chart object as a whole:

import * as Charts from 'chart.js';

This is also possible:

import {Controller, Element, Scale} from 'chart.js';

But it will not allow to get a reference to Charts itself.

In order to get this possible:

import {Chart, Controller, Element, Scale} from 'chart.js';

Chart should reference itself, so Chart.Chart === Chart

in core.js, something like this:

"use strict";

module.exports = function() {

    //Occupy the global variable of Chart, and create a simple base class
    var Chart = function(context, config) { /* ... */ }

        Chart.Chart = Chart;
    return Chart;
};

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions