Esempio n. 1
0
 value: function () {
     // console.log('this in createdCallback points to', this);
     this.innerHTML = 'Just hanging around';
     
     readAttributes.bind(this)()
         .then(resizeElement.bind(this));
 }
Esempio n. 2
0
 value: function (attribute, oldValue, newValue) {
     if (attribute === 'key') {
         buildGraph.bind(this)();
     };
     if (attribute === 'width' || attribute === 'height') {
         readAttributes.bind(this)().then(resizeElement.bind(this));
     }
 }
Esempio n. 3
0
function buildGraph() {

    readAttributes.bind(this)()
      .then(createUrl)
      .then(getJSON)
      .then(generateChart.bind(this))
      .catch(function (e) {
          console.error(e.message);
      })

};
Esempio n. 4
0
function generateChart(data) {

    return readAttributes.bind(this)()
        .then(function(attributes) {

            return c3.generate({
                bindto: this,
                data: {
                    x: data.data[0][0],
                    columns: data.data,
                    type: attributes.type || 'line'
                },
                legend: {
                    position: attributes['legend-position'] || 'bottom'
                }
            });
        }.bind(this)
    );
};