import {makeInner, normalizeToArray} from '../../util/model';

var inner = makeInner();

export default {
    clearColorPalette: function () {
        inner(this).colorIdx = 0;
        inner(this).colorNameMap = {};
    },

    getColorFromPalette: function (name, scope) {
        scope = scope || this;
        var scopeFields = inner(scope);
        var colorIdx = scopeFields.colorIdx || 0;
        var colorNameMap = scopeFields.colorNameMap = scopeFields.colorNameMap || {};
        // Use `hasOwnProperty` to avoid conflict with Object.prototype.
        if (colorNameMap.hasOwnProperty(name)) {
            return colorNameMap[name];
        }
        var colorPalette = normalizeToArray(this.get('color', true));
        if (!colorPalette.length) {
            return;
        }

        var color = colorPalette[colorIdx];
        if (name) {
            colorNameMap[name] = color;
        }
        scopeFields.colorIdx = (colorIdx + 1) % colorPalette.length;

        return color;
    }
};

import {makeInner} from '../../util/model';

var inner = makeInner();

export default {
    clearColorPalette: function () {
        inner(this).colorIdx = 0;
        inner(this).colorNameMap = {};
    },

    getColorFromPalette: function (name, scope) {
        scope = scope || this;
        var scopeFields = inner(scope);
        var colorIdx = scopeFields.colorIdx || 0;
        var colorNameMap = scopeFields.colorNameMap = scopeFields.colorNameMap || {};
        // Use `hasOwnProperty` to avoid conflict with Object.prototype.
        if (colorNameMap.hasOwnProperty(name)) {
            return colorNameMap[name];
        }
        var colorPalette = this.get('color', true) || [];
        if (!colorPalette.length) {
            return;
        }

        var color = colorPalette[colorIdx];
        if (name) {
            colorNameMap[name] = color;
        }
        scopeFields.colorIdx = (colorIdx + 1) % colorPalette.length;

        return color;
    }
};

--- 
+++ 
@@ -1,4 +1,4 @@
-import {makeInner} from '../../util/model';
+import {makeInner, normalizeToArray} from '../../util/model';
 
 var inner = makeInner();
 
@@ -17,7 +17,7 @@
         if (colorNameMap.hasOwnProperty(name)) {
             return colorNameMap[name];
         }
-        var colorPalette = this.get('color', true) || [];
+        var colorPalette = normalizeToArray(this.get('color', true));
         if (!colorPalette.length) {
             return;
         }
Support string value for color.
