Code Monkey home page Code Monkey logo

Comments (5)

pratu16x7 avatar pratu16x7 commented on May 21, 2024 1

@ianjdarrow You'll find them quite down nested in the prototype chain of the Chart object in the console output, given the inheritance. Aside, have you tried actually running the function? I assumed that the functions themselves didn't work.

from charts.

pratu16x7 avatar pratu16x7 commented on May 21, 2024

@ianjdarrow Hmm, would be easier to tell by seeing the usage. Can you share your code?

from charts.

ianjdarrow avatar ianjdarrow commented on May 21, 2024

Of course - thanks. Here's the code:

import Chart from "frappe-charts/dist/frappe-charts.min.esm";

const owners = 
    [{ name: 'Ian', shares: 60 },
     { name: 'Ben', shares: 50 }];

const dataset = { 
    labels: owners.map(owner => owner.name),
    datasets: [{ values: owners.map(owner => owner.shares)}] 
};

const chart = new Chart({
    parent: '#chart',
    data: dataset,
    type: 'bar',
    height: 250,
});

As I mentioned, the chart renders properly, but the desired methods don't seem to be exposed. The chart displays properly and console.log(chart) yields a number of properties, but nothing from the API.

from charts.

ianjdarrow avatar ianjdarrow commented on May 21, 2024

@pratu16x7  thanks so much! Knowing that the functions were nested way down the prototype chain, I was able to confirm that they was there. I have this working now. Not 100% sure what the issue was – probably my own stupidity – but very grateful for your help and your work on this library.

from charts.

pascalw avatar pascalw commented on May 21, 2024

It looks like these functions are not available on all chart types. For example PercentageChart extends from BaseChart which doesn't have the update_values function. Is there a way to dynamically update a PercentageChart?

I'm now using this, which seems to work:

this.frappe.data = nextProps.data;
this.frappe.refresh(true);

Is this the right way to do it? Would be nice if all charts could implement these functions for a consistent API.

from charts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.