zoukankan      html  css  js  c++  java
  • js对象实例化

     var bar4 = new RGraph.Bar('cvs', [[21,31,13, 43,42, 25,42, 29,59, 28,40, 10]])
    js对象实例化
     
    如何实例化呢?
     
    见下,如果不用this,不能为RGraph.Bar这个“类”添加属性,可以再调试的时候,发现这些属性是一个一个出现的
     
    RGraph.Bar = function (id, data) { // Get the canvas and context objects
    this.id = id;
    this.canvas = document.getElementById(id);
    this.context = this.canvas.getContext ? this.canvas.getContext("2d") : null;
    this.canvas.__object__ = this;
    this.type = 'bar';
    this.max = 0;
    this.stackedOrGrouped = false;
    this.isRGraph = true;
    this.uid = RGraph.CreateUID();
    this.canvas.uid = this.canvas.uid ? this.canvas.uid : RGraph.CreateUID();
    this.colorsParsed = false;
    }
     
    里面放入方法也是正常的
     
  • 相关阅读:
    开通博客了
    nginx一些高级配置
    hue的优化
    hue改下载行数
    运维常用脚本
    scala
    kafka调优
    confluent部署:
    Redis主从及哨兵
    Redis配置
  • 原文地址:https://www.cnblogs.com/tianzhiyun/p/2839037.html
Copyright © 2011-2022 走看看