How to use g2-mobile - 10 common examples

To help you get started, we’ve selected a few g2-mobile examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dunwu / frontend-tutorial / codes / antd-admin / src / utils / gm.jsx View on Github external
initChart (props) {
      const {data} = props;
      const chart = new GM.Chart({
        id: this.chartId
      });
      chart.source(data);
      __operation(chart);
      this.chart = chart;
    }
github fireyy / react-antd-admin / src / utils / gm.js View on Github external
initChart(props) {
      const { data } = props;
      const chart = new GM.Chart({
        id: this.chartId
      });
      chart.source(data);
      __operation(chart);
      this.chart = chart;
    }
github alibaba / rax / components / rax-charts / src / Chart.js View on Github external
draw(context) {
    const {children, data, config} = this.props;
    const el = findDOMNode(this.chartInstance);

    if (!children) {
      return;
    }

    context.render();
    this.chart = new GM.Chart({
      el,
      context
    });
    this.chart.source(data, config);
    this.chart.axis(false);

    this.renderChildren(context);
  }
github alibaba / rax / packages / rax-charts / src / charts / Chart.js View on Github external
renderWebChart = () => {
    const {id, margin} = this.props;

    this.chart = new GM.Chart({
      id: id,
      margin: margin
    });
  };
github weex-plugins / Chart-for-Apache-Weex / js / chart.js View on Github external
/**
 * Created by godsong on 16/12/12.
 */
var GM = require('g2-mobile');
var CanvasElement=require('./CanvasElement')
var _ready = false;
var _context;
var _renderQueue = [];
var _chartRender = GM.Chart.prototype.render;
GM.Chart.prototype.render = function () {
    if (_ready) {
        _chartRender.call(this);
        _context.render();
    }
    else {
        _renderQueue.push(this);
    }
};
var G2Chart=GM.Chart;
GM.Chart=function(config){
    var canvasElement=new CanvasElement();
    config.el=canvasElement;
    return new G2Chart(config);
}
module.exports = function (name) {
    switch (name.toLowerCase()) {
github weex-plugins / Chart-for-Apache-Weex / js / chart.js View on Github external
var CanvasElement=require('./CanvasElement')
var _ready = false;
var _context;
var _renderQueue = [];
var _chartRender = GM.Chart.prototype.render;
GM.Chart.prototype.render = function () {
    if (_ready) {
        _chartRender.call(this);
        _context.render();
    }
    else {
        _renderQueue.push(this);
    }
};
var G2Chart=GM.Chart;
GM.Chart=function(config){
    var canvasElement=new CanvasElement();
    config.el=canvasElement;
    return new G2Chart(config);
}
module.exports = function (name) {
    switch (name.toLowerCase()) {
        case 'g2':
            return GM;
        case 'gm':
            return GM;
        default:
            return GM;
    }
};
module.exports.ready = function (context,id,weexElement) {
    _ready = true;
github weex-plugins / Chart-for-Apache-Weex / js / chart.js View on Github external
/**
 * Created by godsong on 16/12/12.
 */
var GM = require('g2-mobile');
var CanvasElement=require('./CanvasElement')
var _ready = false;
var _context;
var _renderQueue = [];
var _chartRender = GM.Chart.prototype.render;
GM.Chart.prototype.render = function () {
    if (_ready) {
        _chartRender.call(this);
        _context.render();
    }
    else {
        _renderQueue.push(this);
    }
};
var G2Chart=GM.Chart;
GM.Chart=function(config){
    var canvasElement=new CanvasElement();
    config.el=canvasElement;
    return new G2Chart(config);
}
module.exports = function (name) {
github alibaba / rax / components / rax-charts / src / Chart.js View on Github external
import {createElement, Component, PropTypes, findDOMNode} from 'rax';
import {isWeex, isWeb} from 'universal-env';
import Canvas from 'rax-canvas';

import GM from 'g2-mobile';

if (isWeb) {
  GM.Global.pixelRatio = 2;
}

class Chart extends Component {
  constructor(props) {
    super(props);
  }

  setRef = (ref) => {
    this.chartInstance = ref;
  };

  componentDidMount() {
    var context = this.chartInstance.getContext();
    this.draw(context);
  }
github fireyy / react-antd-admin / src / views / Home / index.jsx View on Github external
import React from 'react'
import { Row, Col, Table, Alert, Icon } from 'antd';

import GM from 'g2-mobile';
GM.Global.pixelRatio = 2;
const Util = GM.Util;

import PanelBox from '../../components/PanelBox';

import createGM from '../../utils/gm';
import { chartData, pieData, barData } from '../../../fake/chart2.js';

import './index.less'

var Shape = GM.Shape;
var G = GM.G;
//自定义绘制数据的的形状
Shape.registShape('point', 'dashBoard', {
  getShapePoints:function(cfg){
    var x = cfg.x;
    var y = cfg.y;
github fireyy / react-antd-admin / src / views / Home / index.jsx View on Github external
import React from 'react'
import { Row, Col, Table, Alert, Icon } from 'antd';

import GM from 'g2-mobile';
GM.Global.pixelRatio = 2;
const Util = GM.Util;

import PanelBox from '../../components/PanelBox';

import createGM from '../../utils/gm';
import { chartData, pieData, barData } from '../../../fake/chart2.js';

import './index.less'

var Shape = GM.Shape;
var G = GM.G;
//自定义绘制数据的的形状
Shape.registShape('point', 'dashBoard', {
  getShapePoints:function(cfg){
    var x = cfg.x;
    var y = cfg.y;
    return [
      {x: x, y: y},
      {x: x, y: 0.5}
    ]
  },
  drawShape: function(cfg, canvas){
    var point1 = cfg.points[0];
    var point2 = cfg.points[1];
    point1 = this.parsePoint(point1);
    point2 = this.parsePoint(point2);
    G.drawLines([point1, point2], canvas, {

g2-mobile

The mobile version of g2

MIT
Latest version published 7 years ago

Package Health Score

67 / 100
Full package analysis