/*
 *  The MIT License (MIT)
 *
 *  View the full license at:
 *  https://github.com/hendrixjoseph/FamilyTree/blob/master/LICENSE.md
 *
 *  Copyright (c) 2015 Joseph Hendrix
 *
 *  Hosted on GitHub at https://github.com/hendrixjoseph/FamilyTree
 *
 */

package edu.wright.hendrix11.c3;

import edu.wright.hendrix11.c3.axis.XAxis;
import edu.wright.hendrix11.c3.axis.YAxis;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.logging.Logger;

/**
 * @author Joe Hendrix
 */
public class ChartModel
{
    private static final Logger LOG = Logger.getLogger(ChartModel.class.getName());
    private Map<?, ? extends Number[]> arrayData = new LinkedHashMap<>();
    private List<String> barLabels = new ArrayList<>();
    private Map<?, ? extends Number> data = new LinkedHashMap<>();
    private boolean isCategory = false;
    private String title;
    private XAxis xAxis;
    private YAxis yAxis;

    /**
     *
     * @return
     */
    public boolean isCategory()
    {
        return isCategory;
    }

    /**
     *
     * @param isCategory
     */
    public void setIsCategory(boolean isCategory)
    {
        this.isCategory = isCategory;
    }

    /**
     *
     * @return
     */
    public String getTitle()
    {
        return title;
    }

    /**
     *
     * @param title
     */
    public void setTitle(String title)
    {
        this.title = title;
    }

    /**
     *
     * @return
     */
    public XAxis getxAxis()
    {

        return xAxis;
    }

    /**
     *
     * @param label
     */
    public void setxAxis(String label)
    {
        this.xAxis = new XAxis(label);
    }

    /**
     *
     * @param xAxis
     */
    public void setxAxis(XAxis xAxis)
    {
        this.xAxis = xAxis;
    }

    /**
     *
     * @return
     */
    public YAxis getyAxis()
    {
        return yAxis;
    }

    /**
     *
     * @param label
     */
    public void setyAxis(String label)
    {
        this.yAxis = new YAxis(label);
    }

    /**
     *
     * @param yAxis
     */
    public void setyAxis(YAxis yAxis)
    {
        this.yAxis = yAxis;
    }

    /**
     * @param barLabels
     */
    public void setBarLabels(String[] barLabels)
    {
        this.barLabels = Arrays.asList(barLabels);
    }

    /**
     * @return
     */
    public List<String> getBarLabels()
    {
        return barLabels;
    }

    /**
     * @param barLabels
     */
    public void setBarLabels(List<String> barLabels)
    {
        this.barLabels = barLabels;
    }

    /**
     *
     * @return
     */
    public Map<?, ? extends Number[]> getArrayData()
    {
        return arrayData;
    }

    /**
     *
     * @param arrayData
     */
    public void setArrayData(Map<?, ? extends Number[]> arrayData)
    {
        data = new LinkedHashMap<>();
        this.arrayData = arrayData;
    }

    /**
     *
     * @return
     */
    public Map<?, ? extends Number> getData()
    {
        return data;
    }

    /**
     *
     * @param data
     */
    public void setData(Map<?, ? extends Number> data)
    {
        arrayData = new LinkedHashMap<>();
        this.data = data;
    }

    /**
     * @return
     */
    public Set<?> getAxisLabels()
    {
        if ( hasArrayData() )
            return arrayData.keySet();
        else
            return data.keySet();
    }

    /**
     *
     * @param label
     * @return
     */
    public Object[] getArrayData(Object label)
    {
        return arrayData.get(label);
    }

    /**
     *
     * @param label
     * @return
     */
    public Object getData(String label)
    {
        return data.get(label);
    }

    /**
     *
     * @return
     */
    public boolean hasArrayData()
    {
        return arrayData != null && !arrayData.isEmpty();
    }
}

@@ -820,24 +820,77 @@
 ayList%3C%3E();%0A
+    private List%3CString%3E colors = new ArrayList%3C%3E();%0A
     private 
@@ -1061,16 +1061,390 @@
 yAxis;%0A%0A
+    /**%0A     *%0A     * @return%0A     */%0A    public List%3CString%3E getColors()%0A    %7B%0A        return colors;%0A    %7D%0A%0A    /**%0A     *%0A     * @param colors%0A     */    %0A    public void setColors(List%3CString%3E colors)%0A    %7B%0A        this.colors = colors;%0A    %7D%0A%0A    /**%0A     *%0A     * @param color%0A     */    %0A    public void addColor(String color)%0A    %7B%0A        colors.add(color);%0A    %7D%0A%0A
     /**%0A

Update ChartModel.java