How to use the raphael function in raphael

To help you get started, we’ve selected a few raphael 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 nhn / tui.chart / test / plugins / raphaelAreaChart.spec.js View on Github external
left: 162.72727272727275,
                top: 200.08,
                startTop: 224.39999999999998
            },
            {
                left: 209.0909090909091,
                top: 155.696,
                startTop: 224.39999999999998
            },
            {
                left: 255.45454545454547,
                top: 121.03999999999999,
                startTop: 224.39999999999998
            }
        ];
        const paper = raphael(container, dimension.width, dimension.height); // eslint-disable-line new-cap
        const data = {
            theme: {
                colors: ['#f4bf75']
            },
            dimension,
            options: {},
            groupPositions
        };
        it('should set the opacity of series area region by an areaOpacity property.', () => {
            data.options.areaOpacity = 0.3;
            areaChart.render(paper, data);
            const {opacity} = areaChart.groupAreas[0].area.attrs;

            expect(opacity).toBe(0.3);
        });
github RockyRen / mindmaptree / src / libs / Renderer / index.js View on Github external
constructor(options, graph) {
        this.graph = graph;

        this.canvasDom = document.getElementById(options.canvasId);
        this.paper = new Raphael(this.canvasDom);


        this.canvasClickCb = options.canvasClickCb;
        this.nodeClickCb = options.nodeClickCb;

        // 视野设置
        this.viewportHandle = Viewport(this.canvasDom, this.paper);
        this.viewportHandle.setViewportDrag();

        shapeCustomAttr.init(this.paper);

        // svg点击事件:如果点击的是canvas,取消selected
        this.setCanvasClick();
    }
github nhn / tui.chart / test / plugins / raphaelLineTypeBase.spec.js View on Github external
it('should set the existing fill and stroke values.', () => {
            const paper = raphael(document.createElement('DIV'), 100, 100);
            const {dot} = lineTypeBase.renderDot(paper, 1, '#D95576', 1);
            lineTypeBase._setPrevDotAttributes(0, dot);
            spyOn(dot, 'attr');

            lineTypeBase._hideDot(dot, 0, 1);
            const [dotSetArgs] = dot.attr.calls.mostRecent().args;

            expect(dotSetArgs.fill).toBe('#D95576');
            expect(dotSetArgs.stroke).toBe('#D95576');
        });
    });
github nhn / tui.chart / test / components / legends / spectrumLegend.spec.js View on Github external
it('reverse option is true, labels must be in reverse order', () => {
            const paper = raphael(document.createElement('div'), 100, 100);
            const legendSet = paper.set();

            legend.layout = {
                dimension: {
                    height: 200,
                    width: 100
                },
                position: {
                    left: 0,
                    top: 0
                }
            };
            legend.scaleData = {
                labels: [0, 50, 100, 150, 200],
                stepCount: 4
            };
github nhn / tui.chart / test / plugins / raphaelBulletChart.spec.js View on Github external
beforeEach(() => {
        bulletChart = new RaphaelBulletChart();
        bulletChart.theme = {
            colors: ['yellow', 'red'],
            ranges: []
        };
        bulletChart.paper = raphael(paperContainer, 100, 100);
        seriesColor = 'yellow';
    });
github nhn / tui.chart / test / apis / lineChart.api.spec.js View on Github external
beforeEach(() => {
        const container = dom.create('DIV');
        const plotContainer = dom.create('DIV');

        lineChart = lineChartFactory(container, rawData);
        plot = lineChart.componentManager.get('plot');
        plot.paper = raphael(plotContainer, 100, 100);
        plot.paper.pushDownBackgroundToBottom = () => {};
    });
github Kaniwani / kw-frontend / app / common / components / KanjiStroke / dmak-0-3-1.js View on Github external
function giveBirthToRaphael(nbChar, options) {
  const papers = [];
  let paper;

  for (let i = 0; i < nbChar; i += 1) {
    paper = new Raphael(options.element, `${options.width}px`, `${options.height}px`);
    paper.setViewBox(options.viewBox.x, options.viewBox.y, options.viewBox.w, options.viewBox.h);
    paper.canvas.setAttribute('class', 'dmak-svg');
    papers.push(paper);
  }
  return papers.reverse();
}
github jacky6024 / flowdesigner / src / Context.js View on Github external
constructor(container){
        this.undoManager = new UndoManager();
        this.toolsMap=new Map();
        this._initBuiltinTools();
        this.container=container;
        this.paper=new Raphael(container[0],'100%','100%');
        this.allFigures=[];
        this.selectionFigures=[];
        this.selectionRects=this.paper.set();
        this.selectionPaths=this.paper.set();
        this.currentConnection=null;
        this._initEvent();
    }
    selectFigure(figure){
github thingsboard / thingsboard / ui / src / app / components / led-light.directive.js View on Github external
scope.update = function() {
            scope.size = scope.size || 50;
            scope.canvasSize = scope.size;
            scope.radius = scope.canvasSize / 4;
            scope.glowSize = scope.radius / 5;

            var template = '<div style="width: ' + scope.size + 'px; height: ' + scope.size + 'px;" id="canvas_container"></div>';
            element.html(template);
            $compile(element.contents())(scope);
            scope.paper = new Raphael($('#canvas_container', element)[0], scope.canvasSize, scope.canvasSize);
            var center = scope.canvasSize / 2;
            scope.circleElement = scope.paper.circle(center, center, scope.radius);
            scope.draw();
        }
github nhn / tui.chart / src / js / plugins / pluginRaphael.js View on Github external
export const callback = function(container, dimension) {
    const paper = raphael(container, dimension.width, dimension.height);
    const rect = paper.rect(0, 0, dimension.width, dimension.height);

    if (paper.raphael.svg) {
        appendGlowFilterToDefs(paper);
        appendShadowFilterToDefs(paper);
    }

    paper.pushDownBackgroundToBottom = function() {
        rect.toBack();
    };

    paper.changeChartBackgroundColor = function(color) {
        rect.attr({
            fill: color
        });
    };