dimple-js
Version:
Dimple is an object-oriented API allowing you to create flexible axis-based charts using [d3.js](http://d3js.org "d3.js").
15 lines (13 loc) • 757 B
JavaScript
// Copyright: 2015 AlignAlytics
// License: "https://github.com/PMSI-AlignAlytics/dimple/blob/master/MIT-LICENSE.txt"
// Source: /src/objects/chart/methods/getColor.js
// Help: http://github.com/PMSI-AlignAlytics/dimple/wiki/dimple.chart#wiki-getColor
this.getColor = function (tag) {
// If no color is assigned, do so here
if (this._assignedColors[tag] === null || this._assignedColors[tag] === undefined) {
this._assignedColors[tag] = this.defaultColors[this._nextColor];
this._nextColor = (this._nextColor + 1) % this.defaultColors.length;
}
// Return the color
return this._assignedColors[tag];
};