Git Product home page Git Product logo

Comments (3)

Pauan avatar Pauan commented on June 7, 2024

Hi @rahulscp,

You do not need to call validateNow(), instead it is called for you automatically when the chart changes.

If you want to call other methods, the best way is to use the init event listener which gives you access to the chart:

const makeChart = ({ dataProvider, fillColors } : Configuration) => {
  return {
    "type": "serial",
    "theme": "light",
    ...
    "listeners": [{
      "event": "init",
      "method": function (x: any) {
        x.chart.zoomOut();
      }
    }]
  };
};

from amcharts3-angular2.

QuocMinhTran avatar QuocMinhTran commented on June 7, 2024

Hi, I tried to add 1 more item to the dataset but nothing changed.
Onclick() {
this.data.push({"category": "Module #6",
"segments": [{
"start": 4,
"end": 6,
"color": "#448e4d",
"task": "Gathering requirements"
}, {
"start": 7,
"end": 9,
"task": "Producing specifications"
}, {
"start": 11,
"end": 15,
"task": "Development"
}, {
"start": 16,
"end": 18,
"task": "Testing and QA"
}]})
console.log(this.data);
this.chart.dataProvider = this.data;
}
}

from amcharts3-angular2.

Pauan avatar Pauan commented on June 7, 2024

@QuocMinhTran As explained on the main page, if you want to make a change to your chart's configuration, you need to first make a deep copy:

// Make a copy of the existing config
this.chart = JSON.parse(JSON.serialize(this.chart));

// Change the config
this.chart.dataProvider.push(...);

Alternatively you can use a function to generate the configuration and then call that function on every change:

function makeConfig(dataProvider) {
  return {
    "type": "serial",
    "theme": "light",
    "dataProvider": dataProvider
    ...
  };
}
// Change the config
this.chart = makeConfig([...]);

The reason this is necessary is because of how Angular2 handles data updates.

from amcharts3-angular2.

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.