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

HighCharts examples #27

Open
3goats opened this issue Jun 15, 2015 · 1 comment
Open

HighCharts examples #27

3goats opened this issue Jun 15, 2015 · 1 comment

Comments

@3goats
Copy link

3goats commented Jun 15, 2015

Hi,

I would like to use the HighCharts libraries with lightning. Would it be possible to provide some examples of how to achieve this.

Thanks.

@mathisonian
Copy link
Member

Hey @carlskii!

The approach I would take is the following. Create a custom visualization locally using the generator. Then fill in the following functions with high-charts specific code:

var LightningVisualization = require('lightning-visualization');

var LightningHighchart = LightningVisualization.extend({

    init: function() {
        this.render();
    },

    render: function() {
        // instantiate the high chart here.
        // you have access to "this.el" or "this.selector" for dealing with the DOM
        // and you have access to this.data, the data that should actually be rendered.
    },

    formatData: function(data) {
         // transform data if necessary. This is called before init and is called on the data passed to update data and appendData
    },

    updateData: function(formattedData) {
         // if you want the chart to have the ability to update fill in this function
         // this will involve updating the highchart that was created in the render function somehow
    },

    appendData: function(formattedData) {
        // same idea as updateData but appending instead of replacing it
    }

});


module.exports = LightningHighchart;

If you have questions about more specific details or get stuck anywhere along the way, feel free to post them here, we're happy to help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants