windows 10 pro office 2019 pro office 365 pro windows 10 home windows 10 enterprise office 2019 home and business office 2016 pro windows 10 education visio 2019 microsoft project 2019 microsoft project 2016 visio professional 2016 windows server 2012 windows server 2016 windows server 2019 Betriebssysteme office software windows server https://softhier.com/ instagram takipçi instagram beğeni instagram görüntüleme instagram otomatik beğeni facebook beğeni facebook sayfa beğenisi facebook takipçi twitter takipçi twitter beğeni twitter retweet youtube izlenme youtube abone instagram

How can we build charts on Polymer 1.0 using Chart.js?

Asked By: Anonymous

I wonder if we have readily available chart elements for polymer 1.0. I am trying to migrate chart-doughnut (https://github.com/robdodson/chart-elements/) from polymer 0.5 to 1.0 which uses Chart.js script.

I have migrated the chart-doughnut.html file in following way :

_x000D_

_x000D_

  <link rel="import" href="bower_components/polymer/polymer.html">_x000D_
  <link rel="import" href="chart-js-import.html">_x000D_
  _x000D_
  <!--_x000D_
  Pie and doughnut charts are probably the most commonly used chart there are. They are divided into segments, the arc of each segment shows a the proportional value of each piece of data._x000D_
  _x000D_
  They are excellent at showing the relational proportions between data._x000D_
  _x000D_
  Pie and doughnut charts in are effectively the same class in Chart.js, but have one different default value - their percentageInnerCutout. This equates what percentage of the inner should be cut out. This defaults to 0 for pie charts, and 50 for doughnuts._x000D_
  _x000D_
  They are also registered under two aliases in the Chart core. Other than their different default value, and different alias, they are exactly the same._x000D_
  _x000D_
  ##### Example_x000D_
  _x000D_
      <chart-doughnut values="[30, 50, 100, 40, 120]"></chart-doughnut>_x000D_
  _x000D_
  @element chart-doughnut_x000D_
  @blurb A chart for showing the relational proportions between data._x000D_
  @status alpha_x000D_
  @homepage http://robdodson.github.io/chart-elements_x000D_
  -->_x000D_
  <dom-module id="chart-doughnut">_x000D_
    <template>_x000D_
      <canvas id="canvas" width="{{width}}" height="{{height}}"></canvas>_x000D_
    </template>_x000D_
  <script>_x000D_
    Polymer({_x000D_
      is: 'chart-doughnut',_x000D_
      properties: {_x000D_
        colors: {_x000D_
          type: Array,_x000D_
          value: ['#F7464A',_x000D_
              '#46BFBD',_x000D_
              '#FDB45C',_x000D_
              '#949FB1',_x000D_
              '#4D5360'_x000D_
            ];_x000D_
          },_x000D_
          notify: true,_x000D_
          observer: 'updateChart'_x000D_
        },_x000D_
        height: {_x000D_
          notify: true,_x000D_
          observer: 'resize'_x000D_
        },_x000D_
        options: {_x000D_
          type: Object,_x000D_
          value: {};_x000D_
          },_x000D_
          notify: true,_x000D_
          observer: 'updateChart'_x000D_
        },_x000D_
        values: {_x000D_
          type: Array,_x000D_
          value: [_x000D_
              30,_x000D_
              50,_x000D_
              100,_x000D_
              40,_x000D_
              120_x000D_
            ];_x000D_
          },_x000D_
          notify: true,_x000D_
          observer: 'updateChart'_x000D_
        },_x000D_
        width: {_x000D_
          notify: true,_x000D_
          observer: 'resize'_x000D_
        }_x000D_
      },_x000D_
      resize: function () {_x000D_
        if (this.chart) {_x000D_
          this.updateChart();_x000D_
        }_x000D_
      },_x000D_
      updateChart: function () {_x000D_
        this.async(function () {_x000D_
          if (this.chart) {_x000D_
            console.log("CHARTTTT"+this.chart);_x000D_
            this.chart.destroy();  // Bindings don't seem to be taking effect properly so_x000D_
                                   // manually set width and height_x000D_
            // Bindings don't seem to be taking effect properly so_x000D_
            // manually set width and height_x000D_
            this.$.canvas.setAttribute('width', this.width);_x000D_
            this.$.canvas.setAttribute('height', this.height);_x000D_
          }_x000D_
          this.data = [];_x000D_
          this.values.forEach(function (val, i) {_x000D_
            this.data.push({_x000D_
              color: this.colors[i],_x000D_
              value: val_x000D_
            });_x000D_
          }, this);_x000D_
          this.ctx = this.$.canvas.getContext('2d');_x000D_
          this.chart = new Chart(this.ctx).Doughnut(this.data, this.options);_x000D_
        }, null, 0);_x000D_
      }_x000D_
    });_x000D_
  </script>_x000D_
   </dom-module>

_x000D_

_x000D_

x000D

But on using it, i am getting the below error in Chart.js

Uncaught IndexSizeError: Failed to execute ‘arc’ on ‘CanvasRenderingContext2D’: The radius provided (-0.5) is negative.
Chart.js:1226 0 0 -0.5 4.71238898038469 4.713461589614612

pls suggest.


Solution

Answered By: Anonymous

The chart canvas doesn’t have width and height when you are initializing it.

The easiest way to fix it would be to just move it into the next tick with a setTimeout.

var self = this;
setTimeout(function() {
    self.chart = new Chart(self.ctx).Doughnut(self.data, self.options);
}, 0)

Plunkr – http://plnkr.co/edit/i3HrDxd5jUfTfLPVlNPg?p=preview


Note that if you are doing the same thing for line charts, the attributes need to be proper JSON (i.e. should use ” instead of ‘)

<chart-line width="400"
            height="200"
            labels='["Monday","Tuesday","Wednesday","thursday","Friday","Saturday","Sunday"]'
            values="[[10,14,20,25,13,9,40]]"
            colors='["253,180,92","247,70,74","70,191,189","148,159,177","77,83,96"]'>
</chart-line>

Plunkr – http://plnkr.co/edit/o74WRX404NWhHGiNqkC8?p=preview

techinplanet staff

instagram volgers kopen volgers kopen buy windows 10 pro buy windows 11 pro


Windows 10 Kaufen Windows 10 Pro Office 2019 Kaufen Office 365 Lizenz Windows 10 Home Lizenz Office 2019 Home Business Kaufen windows office 365 satın al follower kaufen instagram follower kaufen porno
Alanya escort Manavgat escort Fethiye escort Kemer escort Didim escort Çanakkale escort Aydın escort Muğla escort Tekirdağ escort Manisa escort Balıkesir escort Trabzon escort Elazığ escort Ordu escort Kütahya escort Isparta escort Rize escort Kahramanmaraş escort Yalova escort Giresun escort Yozgat escort Tokat escort Şanlıurfa escort Sivas escort Batman escort Erzurum escort Sinop escort Kırşehir escort Karaman escort Kırıkkale escort Bolu escort Amasya escort Niğde escort Uşak escort Edirne escort Çorum escort Osmaniye escort Zonguldak escort Van escort Erzincan escort Söke escort Bodrum escort Çerkezköy escort Akhisar escort Bandırma escort Ayvacık escort Akçaabat escort Karakoçan escort Altınordu escort Tavşanlı escort Eğirdir escort Ardeşen escort Afşin escort Altınova escort Bulancak escort Sorgun escort Erbaa escort Viranşehir escort Zara escort Kozluk escort Aziziye escort Ayancık escort Kaman escort Ermenek escort Keskin escort Gerede escort Göynücek escort Bor escort Banaz escort Havsa escort Osmancık escort Bahçe escort Alaplı escort Başkale escort Kemah escort Nazilli escort Fethiye escort Çorlu escort Alaşehir escort Altıeylül escort Biga escort Araklı escort Kovancılar escort Fatsa escort Simav escort Yalvaç escort Çayeli escort Dulkadiroğlu escort Çiftlikköy escort Espiye escort Sarıkaya escort Niksar escort Suruç escort Yıldızeli escort Sason escort Horasan escort Boyabat escort Mucur escort Sarıveliler escort Yahşihan escort Göynük escort Gümüşhacıköy escort Çamardı escort Eşme escort İpsala escort Sungurlu escort Hasanbeyli escort Çaycuma escort İpekyolu escort Refahiye escort Kuşadası escort Marmaris escort Süleymanpaşa escort Turgutlu escort Susurluk escort Gelibolu escort Of escort Ünye escort Domaniç escort Fındıklı escort Elbistan escort Çınarcık escort Tirebolu escort Akdağmadeni escort Turhal escort Eyyübiye escort Suşehri escort Yakutiye escort Gerze escort Mengen escort Merzifon escort Ulukışla escort Sivaslı escort Keşan escort Kadirli escort Ereğli escort Özalp escort Tercan escort Efeler escort Didim escort Çine escort Dalaman escort Menteşe escort Milas escort Ortaca escort Seydikemer escort Ergene escort Kapaklı escort Malkara escort Salihli escort Şehzadeler escort Soma escort Yunusemre escort Ayvalık escort Bigadiç escort Burhaniye escort Gönen escort Karesi escort Çan escort Yenice escort Ortahisar escort Yomra escort Perşembe escort Pazar escort Onikişubat escort Pazarcık escort Türkoğlu escort Eynesil escort Görele escort Piraziz escort Yağlıdere escort Çayıralan escort Boğazlıyan escort Zile escort Siverek escort Karaköprü escort Haliliye escort Akçakale escort Şarkışla escort Gemerek escort Oltu escort Palandöken escort Mudurnu escort Suluova escort Taşova escort Toprakkale escort Kilimli escort Tuşba escort Üzümlü escort