Advertisement
marcopolorez

Chart.js

Jul 28th, 2016
355
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. qx.Class.define("integweb.widget.Chart", {
  2.    
  3.     extend  : qx.ui.core.Widget,
  4.  
  5.     construct : function(height, width, data, chart) {
  6.  
  7.         this.base(arguments);
  8.  
  9.         this._chart  = chart;
  10.         this._data   = data;
  11.         this._height = height;
  12.         this._width  = width;
  13.  
  14.         this._createChart();
  15.  
  16.     },
  17.  
  18.     members : {
  19.  
  20.         _chart : null,
  21.         _height : null,
  22.         _width : null,
  23.         _data : null,
  24.  
  25.         _createChart : function() {
  26.  
  27.             var hash = "chart" + this.toHashCode();
  28.  
  29.             var canvas = new qx.html.Element("div", { minWidth : '100%', minHeight : '100%' }, { id: hash });
  30.            
  31.             if ( this._height )
  32.                 this.setHeight(this._height);
  33.             else
  34.                 this.setWidth(this._width);
  35.  
  36.             this.addListener("appear", function() {
  37.                 this._chart(this._data, hash);
  38.             });
  39.  
  40.             this.addListener("resize", function(e) {
  41.                 var that = this;
  42.                 setTimeout(function(){ that._chart(that._data, hash); }, 100);
  43.             });
  44.  
  45.             this.getContentElement().add(canvas);
  46.  
  47.         }
  48.  
  49.     }
  50.  
  51. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement