public static ChartJScolorhelper GetChartColorFromLabel(string cmdr) { string cmdr_col = "#0000ff"; if (DSdata.CMDRcolor.ContainsKey(cmdr)) { cmdr_col = DSdata.CMDRcolor[cmdr]; } Color color = ColorTranslator.FromHtml(cmdr_col); string temp_col = color.R + ", " + color.G + ", " + color.B; ChartJScolorhelper col = new ChartJScolorhelper(); col.backgroundColor = "rgba(" + temp_col + ", 0.5)"; col.borderColor = "rgba(" + temp_col + ",1)"; col.barborderColor = "rgb(255, 0, 0)"; col.pointBackgroundColor = "rgba(" + temp_col + ", 0.2)"; return(col); }
public ChartJScolorhelper GetRandomChartColor() { Random rnd = new Random(); string temp_col = "50, 51, 0"; if (mycolorPool.Count() > 0) { int iCol = rnd.Next(0, mycolorPool.Count()); temp_col = mycolorPool[iCol]; mycolorPool.RemoveAt(iCol); } ChartJScolorhelper col = new ChartJScolorhelper(); col.backgroundColor = "rgba(" + temp_col + ", 0.5)"; col.borderColor = "rgba(" + temp_col + ",1)"; col.barborderColor = "rgb(255, 0, 0)"; col.pointBackgroundColor = "rgba(" + temp_col + ", 0.2)"; return(col); }
public ChartJScolorhelper GetChartColor(bool winner) { Random rnd = new Random(); string temp_col = "255, 255, 255"; if (winner) { temp_col = "1, 200, 1"; } else { temp_col = "200, 1, 1"; } ChartJScolorhelper col = new ChartJScolorhelper(); col.backgroundColor = "rgba(" + temp_col + ", 0.5)"; col.borderColor = "rgba(" + temp_col + ",1)"; col.barborderColor = "rgb(255, 0, 0)"; col.pointBackgroundColor = "rgba(" + temp_col + ", 0.2)"; return(col); }