"use strict"; /** * Licensed Materials - Property of IBM * IBM Cognos Products: Cognos Analytics * Copyright IBM Corp. 2015, 2016 * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */ define(['q', 'jquery', 'rave2', 'bi/glass/app/util/View'], function (Q, $, rave, View) { 'use strict'; //NOSONAR: meant to be strict var VizControl = View.extend({ legend: {}, _colorSacle: null, margin: { top: 10, right: 20, bottom: 10, left: 20 }, init: function init(options) { VizControl.inherited('init', this, arguments); $.extend(this, options); this.width = this.$el.width() || this.parentWidth; this.height = this.$el.height(); this.svgWidth = this.width - this.margin.left - this.margin.right; this.svgHeight = this.height - this.margin.top - this.margin.bottom; this._colorScale = rave.scale.ordinal().domain(['scheduled', 'cancelled', 'canceled', 'terminated', 'success', 'failed', 'executing', 'pending', 'suspended', 'disabled', 'enabled', 'purged']).range(['#5AA700', '#AEB8B8', '#AEB8B8', '#99CCCC', '#5AA700', '#FF5050', '#4178BE', '#D9E4F2', '#FDD600', '#AEB8B8', '#5AA700', '#336699']); this.$el.empty(); this.svg = rave.select(this.el).append('svg').attr('width', this.width).attr('height', this.height); if (this.data) { this._draw(this.data); } }, clear: function clear() { this.svg.html(''); }, _draw: function _draw() {}, setData: function setData(data) { this.data = data; this.clear(); this._draw(data); } }); return VizControl; });