package controllers.gui.util;

import org.codehaus.jackson.annotate.JsonIgnore;

import play.templates.JavaExtensions;

public class ChartSeries {

	private String name;
	private String units;
	private String color;
	private int axisIndex;
	private String dashStyle;
	
	public String getName() {
		return JavaExtensions.escapeJavaScript(name);
	}
	public void setName(String columnName) {
		this.name = columnName;
	}
	public String getUnits() {
		return JavaExtensions.escapeJavaScript(units);
	}
	public void setUnits(String units) {
		this.units = units;
	}
	public String getColor() {
		return JavaExtensions.escapeJavaScript(color);
	}
	public void setColor(String color) {
		this.color = color;
	}
	public int getAxisIndex() {
		return axisIndex;
	}
	public void setAxisIndex(int axisIndex) {
		this.axisIndex = axisIndex;
	}
	@JsonIgnore
	public int getAxis() {
		return axisIndex-1;
	}
	
	public void setDashStyle(String style) {
		this.dashStyle = style;
	}
	public String getDashStyle() {
		return JavaExtensions.escapeJavaScript(dashStyle);
	}
}

@@ -24,16 +24,60 @@
 .util;%0A%0A
+import org.apache.commons.lang.StringUtils;%0A
 import o
@@ -712,24 +712,119 @@
 ng color) %7B%0A
+%09%09if (!StringUtils.isBlank(color) && !StringUtils.startsWith(color,%22#%22))%0A%09%09%09color = %22#%22+color;%0A
 %09%09this.color

fix to allow hex colors to be specified without leading #