private void RefreshChart() { //ArrayList ht = new ArrayList(); //ht.Add(Color.Red); //ht.Add(Color.Blue); //ht.Add(Color.Green); //ht.Add(Color.Yellow); //ht.Add(Color.HotPink); //ht.Add(Color.LawnGreen); //ht.Add(Color.Khaki); //ht.Add(Color.LightSlateGray); //ht.Add(Color.LightSeaGreen); //ht.Add(Color.Lime); IList <FORBaseColor> list = Services.BaseService.GetList <FORBaseColor>("SelectFORBaseColorByWhere", "Remark='" + this.forecastReport.ID.ToString() + "-" + typeFlag + "'"); IList <FORBaseColor> li = new List <FORBaseColor>(); bool bl = false; foreach (DataRow row in dataTable.Rows) { bl = false; foreach (FORBaseColor bc in list) { if (row["Title"].ToString() == bc.Title) { bl = true; FORBaseColor bc1 = new FORBaseColor(); bc1.Color1 = Color.Blue; CopyBaseColor(bc1, bc); li.Add(bc1); } } if (!bl) { FORBaseColor bc1 = new FORBaseColor(); bc1.UID = Guid.NewGuid().ToString(); bc1.Remark = this.forecastReport.ID.ToString() + "-" + typeFlag; bc1.Title = row["Title"].ToString(); bc1.Color = 16711680; bc1.Color1 = Color.Blue; Services.BaseService.Create <FORBaseColor>(bc1); li.Add(bc1); } } ArrayList ht = new ArrayList(); foreach (FORBaseColor bc2 in li) { ht.Add(bc2.Color1); } List <Ps_Forecast_Math> listValues = new List <Ps_Forecast_Math>(); for (int i = 0; i < this.dataTable.Rows.Count; i++) { DataRow row = this.dataTable.Rows[i]; foreach (TreeListColumn col in treeList1.Columns) { if (col.FieldName.IndexOf("y") > -1) { object obj = row[col.FieldName]; if (obj != DBNull.Value) { Ps_Forecast_Math v = new Ps_Forecast_Math(); v.ForecastID = forecastReport.ID; v.ID = (string)row["ID"]; v.Title = row["Title"].ToString(); v.Sort = Convert.ToInt32(col.FieldName.Replace("y", "")); v.y1990 = (double)row[col.FieldName]; listValues.Add(v); } } } } chart1.Series.Clear(); ArrayList al = new ArrayList(); al.Add(Application.StartupPath + "/img/1.ico"); al.Add(Application.StartupPath + "/img/2.ico"); al.Add(Application.StartupPath + "/img/3.ico"); al.Add(Application.StartupPath + "/img/4.ico"); al.Add(Application.StartupPath + "/img/5.ico"); al.Add(Application.StartupPath + "/img/6.ico"); al.Add(Application.StartupPath + "/img/7.ico"); chart1.DataBindCrossTab(listValues, "Title", "Sort", "y1990", ""); LegendItem legendItem; LegendCell legendCell1; LegendCell legendCell2; LegendCell legendCell3; Legend legend = new Legend(); legend.AutoFitText = false; //legend.BackColor = System.Drawing.Color.Transparent; //legend.BorderColor = System.Drawing.Color.FromArgb(((System.Byte)(64)), ((System.Byte)(64)), ((System.Byte)(64)), ((System.Byte)(64))); for (int i = 0; i < chart1.Series.Count; i++) { int j = i % 10; legendItem = new Dundas.Charting.WinControl.LegendItem(); legendCell1 = new Dundas.Charting.WinControl.LegendCell(); legendCell2 = new Dundas.Charting.WinControl.LegendCell(); legendCell3 = new Dundas.Charting.WinControl.LegendCell(); legendCell1.CellType = Dundas.Charting.WinControl.LegendCellType.Image; legendCell2.CellType = Dundas.Charting.WinControl.LegendCellType.Image; legendCell1.Name = "Cell1"; legendCell2.Name = "Cell2"; legendCell3.Alignment = System.Drawing.ContentAlignment.MiddleLeft; legendCell3.Name = "Cell3"; legendCell3.Text = chart1.Series[i].Name; legendCell3.TextColor = (Color)ht[i]; chart1.Series[i].Color = (Color)ht[i]; chart1.Series[i].Name = (i + 1).ToString() + "." + chart1.Series[i].Name; chart1.Series[i].Type = Dundas.Charting.WinControl.SeriesChartType.Line; chart1.Series[i].MarkerImage = al[i % 7].ToString(); chart1.Series[i].MarkerSize = 7; chart1.Series[i].MarkerStyle = (Dundas.Charting.WinControl.MarkerStyle)(2); chart1.Series[i].ShowInLegend = false; chart1.Series[i].Enabled = true; chart1.Series[i].XValueIndexed = true; legendItem.Cells.Add(legendCell1); legendItem.Cells.Add(legendCell2); legendItem.Cells.Add(legendCell3); legendItem.Tag = chart1.Series[i]; legendItem.Cells[1].Image = al[i % 7].ToString(); if (checkBox1.Checked) { legendItem.Cells[0].Image = string.Format(Application.StartupPath + @"/img/chk_checked.png"); } else { legendItem.Cells[0].Image = string.Format(Application.StartupPath + @"/img/chk_unchecked.png"); } legend.CustomItems.Add(legendItem); chart1.Series[i].Enabled = checkBox1.Checked; } chart1.ChartAreas["Default"].AxisY.MinorGrid.Enabled = true; chart1.ChartAreas["Default"].AxisY.MinorGrid.LineStyle = ChartDashStyle.Dash; chart1.ChartAreas["Default"].AxisY.MinorGrid.LineColor = Color.Gray; legend.Name = "Default"; this.chart1.Legends.Add(legend); }
/// <summary> /// 重新设置是否显示chart控件的多条曲线 /// </summary> /// <param name="_ChartObject">chart对象</param> /// <param name="_CheckBoxObject">checkBox对象</param> /// <param name="hs">存放颜色数组</param> /// <param name="al">存放图片的数组</param> public void SetChart(Dundas.Charting.WinControl.Chart _ChartObject,System.Windows.Forms.CheckBox _CheckBoxObject,ArrayList hs,ArrayList al) { LegendItem legendItem; LegendCell legendCell1; LegendCell legendCell2; LegendCell legendCell3; Legend legend = new Legend(); legend.AutoFitText = false; if(al == null) { al = new ArrayList(); AddIco(al); } if (_ChartObject != null && _CheckBoxObject != null) { for(int i = 0; i < _ChartObject.Series.Count; ++i) { legendItem = new Dundas.Charting.WinControl.LegendItem(); legendCell1 = new Dundas.Charting.WinControl.LegendCell(); legendCell1.CellType = Dundas.Charting.WinControl.LegendCellType.Image; legendCell1.Name = "Cell1"; legendCell2 = new Dundas.Charting.WinControl.LegendCell(); legendCell3 = new Dundas.Charting.WinControl.LegendCell(); legendCell3.CellType = Dundas.Charting.WinControl.LegendCellType.Image; legendCell3.Name = "Cell3"; legendCell2.Name = "Cell2"; legendCell2.Alignment = System.Drawing.ContentAlignment.MiddleLeft; legendCell2.Text = _ChartObject.Series[i].Name; if(hs != null) { legendCell2.TextColor = (Color)hs[i]; _ChartObject.Series[i].Color = (Color)hs[i]; } _ChartObject.Series[i].Name = (i + 1).ToString() + "." + _ChartObject.Series[i].Name; _ChartObject.Series[i].Type = Dundas.Charting.WinControl.SeriesChartType.Line; _ChartObject.Series[i].MarkerImage = al[i % 7].ToString(); _ChartObject.Series[i].MarkerSize = 7; _ChartObject.Series[i].MarkerStyle = (Dundas.Charting.WinControl.MarkerStyle)(2); _ChartObject.Series[i].ShowInLegend = false; legendItem.Cells.Add(legendCell1); legendItem.Cells.Add(legendCell2); legendItem.Tag = _ChartObject.Series[i]; if (_CheckBoxObject.Checked) { legendItem.Cells[0].Image = string.Format(Application.StartupPath + @"/img/chk_checked.png"); } else { legendItem.Cells[0].Image = string.Format(Application.StartupPath + @"/img/chk_unchecked.png"); } legend.CustomItems.Add(legendItem); _ChartObject.Series[i].Enabled = _CheckBoxObject.Checked; } _ChartObject.ChartAreas["Default"].AxisX.MinorGrid.Enabled = false; _ChartObject.ChartAreas["Default"].AxisY.MinorGrid.Enabled = true; _ChartObject.ChartAreas["Default"].AxisY.MinorGrid.LineStyle = ChartDashStyle.Dash; _ChartObject.ChartAreas["Default"].AxisY.MinorGrid.LineColor = Color.Gray; legend.Name = "Default"; _ChartObject.Legends.Add(legend); } }
public void RefreshChart() { if (charttypestring == "yt" && checkE_3d.Checked) { checkE_3d.Checked = false; MessageBox.Show("������Χ������ʾ3dЧ����"); } chart1.Series.Clear(); LegendItem legendItem; LegendCell legendCell1; LegendCell legendCell2; LegendCell legendCell3; Legend legend = new Legend(); legend.AutoFitText = false; chart1.DataBindCrossTab(c_chartlistvalue, c_str1, c_str2, c_str3, ""); chart1.ChartAreas["Default"].BackColor = chartbackcolor; chart1.ChartAreas["Default"].AxisY.MinorGrid.LineStyle = ChartDashStyle.Dash; chart1.ChartAreas["Default"].AxisY.MinorGrid.LineColor = Color.Gray; chart1.ChartAreas["Default"].AxisX.MinorGrid.Enabled = false; chart1.ChartAreas["Default"].AxisY.MinorGrid.Enabled = true; //��Ӧ������ɫ //ArrayList chartcolor = chartbasecolor(); for (int i = 0; i < chart1.Series.Count; i++) { legendItem = new Dundas.Charting.WinControl.LegendItem(); legendCell1 = new Dundas.Charting.WinControl.LegendCell(); legendCell1.CellType = Dundas.Charting.WinControl.LegendCellType.Image; legendCell1.Name = "Cell1"; legendCell2 = new Dundas.Charting.WinControl.LegendCell(); legendCell3 = new Dundas.Charting.WinControl.LegendCell(); legendCell2.CellType = Dundas.Charting.WinControl.LegendCellType.Image; legendCell2.Name = "Cell2"; legendCell3.Alignment = System.Drawing.ContentAlignment.MiddleLeft; legendCell3.Name = "Cell3"; legendCell3.Text = (i + 1) + "." + chart1.Series[i].Name; legendCell3.TextColor = (Color)c_chartcolor[i]; chart1.Series[i].Color = (Color)c_chartcolor[i]; chart1.Series[i].Name = (i + 1).ToString() + "." + chart1.Series[i].Name; chart1.Series[i].Type = charttype(i); chart1.Series[i].ShowInLegend = false; legendItem.Cells.Add(legendCell1); legendItem.Cells.Add(legendCell3); legendItem.Tag = chart1.Series[i]; //ʹ��ȫѡ���ǵ�һ������ if (checkbox1chagned || isfirst == "yes") { if (checkEall.Checked) { legendItem.Cells[0].Image = string.Format(Application.StartupPath + @"/img/chk_checked.png"); } else { legendItem.Cells[0].Image = string.Format(Application.StartupPath + @"/img/chk_unchecked.png"); } string tempstr = legendItem.Cells[1].Text; tempstr = tempstr.Substring(tempstr.IndexOf(".") + 1, tempstr.Length - tempstr.IndexOf(".") - 1); chartcheck_value(tempstr, checkEall.Checked); } else { string tempstr = legendItem.Cells[1].Text; tempstr = tempstr.Substring(tempstr.IndexOf(".") + 1, tempstr.Length - tempstr.IndexOf(".") - 1); if (chartcheck_has(tempstr)) { legendItem.Cells[0].Image = string.Format(Application.StartupPath + @"/img/chk_checked.png"); } else { legendItem.Cells[0].Image = string.Format(Application.StartupPath + @"/img/chk_unchecked.png"); } } legend.CustomItems.Add(legendItem); string tempstr1 = legendItem.Cells[1].Text; tempstr1 = tempstr1.Substring(tempstr1.IndexOf(".") + 1, tempstr1.Length - tempstr1.IndexOf(".") - 1); chart1.Series[i].Enabled = chartcheck_has(tempstr1); } legend.Name = "Default"; this.chart1.Legends.Add(legend); isfirst = "no"; }
public void RefreshChart() { if (charttypestring == "yt" && checkE_3d.Checked) { checkE_3d.Checked = false; MessageBox.Show("样条范围不能显示3d效果!"); } chart1.Series.Clear(); LegendItem legendItem; LegendCell legendCell1; LegendCell legendCell2; LegendCell legendCell3; Legend legend = new Legend(); legend.AutoFitText = false; chart1.DataBindCrossTab(c_chartlistvalue, c_str1, c_str2, c_str3, ""); chart1.ChartAreas["Default"].BackColor = chartbackcolor; chart1.ChartAreas["Default"].AxisY.MinorGrid.LineStyle = ChartDashStyle.Dash; chart1.ChartAreas["Default"].AxisY.MinorGrid.LineColor = Color.Gray; chart1.ChartAreas["Default"].AxisX.MinorGrid.Enabled = false; chart1.ChartAreas["Default"].AxisY.MinorGrid.Enabled = true; //对应类别的颜色 //ArrayList chartcolor = chartbasecolor(); for (int i = 0; i < chart1.Series.Count; i++) { legendItem = new Dundas.Charting.WinControl.LegendItem(); legendCell1 = new Dundas.Charting.WinControl.LegendCell(); legendCell1.CellType = Dundas.Charting.WinControl.LegendCellType.Image; legendCell1.Name = "Cell1"; legendCell2 = new Dundas.Charting.WinControl.LegendCell(); legendCell3 = new Dundas.Charting.WinControl.LegendCell(); legendCell2.CellType = Dundas.Charting.WinControl.LegendCellType.Image; legendCell2.Name = "Cell2"; legendCell3.Alignment = System.Drawing.ContentAlignment.MiddleLeft; legendCell3.Name = "Cell3"; legendCell3.Text = (i + 1) + "." + chart1.Series[i].Name; legendCell3.TextColor = (Color)c_chartcolor[i]; chart1.Series[i].Color = (Color)c_chartcolor[i]; chart1.Series[i].Name = (i + 1).ToString() + "." + chart1.Series[i].Name; chart1.Series[i].Type = charttype(i); chart1.Series[i].ShowInLegend = false; legendItem.Cells.Add(legendCell1); legendItem.Cells.Add(legendCell3); legendItem.Tag = chart1.Series[i]; //使用全选或是第一次载入 if (checkbox1chagned || isfirst == "yes") { if (checkEall.Checked) { legendItem.Cells[0].Image = string.Format(Application.StartupPath + @"/img/chk_checked.png"); } else { legendItem.Cells[0].Image = string.Format(Application.StartupPath + @"/img/chk_unchecked.png"); } string tempstr = legendItem.Cells[1].Text; tempstr = tempstr.Substring(tempstr.IndexOf(".") + 1, tempstr.Length - tempstr.IndexOf(".") - 1); chartcheck_value(tempstr, checkEall.Checked); } else { string tempstr = legendItem.Cells[1].Text; tempstr = tempstr.Substring(tempstr.IndexOf(".") + 1, tempstr.Length - tempstr.IndexOf(".") - 1); if (chartcheck_has(tempstr)) { legendItem.Cells[0].Image = string.Format(Application.StartupPath + @"/img/chk_checked.png"); } else { legendItem.Cells[0].Image = string.Format(Application.StartupPath + @"/img/chk_unchecked.png"); } } legend.CustomItems.Add(legendItem); string tempstr1 = legendItem.Cells[1].Text; tempstr1 = tempstr1.Substring(tempstr1.IndexOf(".") + 1, tempstr1.Length - tempstr1.IndexOf(".") - 1); chart1.Series[i].Enabled = chartcheck_has(tempstr1); } legend.Name = "Default"; this.chart1.Legends.Add(legend); isfirst = "no"; }
private void RefreshChart() { //ArrayList ht = new ArrayList(); //ht.Add(Color.Red); //ht.Add(Color.Blue); //ht.Add(Color.Green); //ht.Add(Color.Yellow); //ht.Add(Color.HotPink); //ht.Add(Color.LawnGreen); //ht.Add(Color.Khaki); //ht.Add(Color.LightSlateGray); //ht.Add(Color.LightSeaGreen); //ht.Add(Color.Lime); IList<FORBaseColor> list = Services.BaseService.GetList<FORBaseColor>("SelectFORBaseColorByWhere", "Remark='" + this.forecastReport.ID.ToString() + "-" + typeFlag + "'"); IList<FORBaseColor> li = new List<FORBaseColor>(); bool bl = false; foreach (DataRow row in dataTable.Rows) { bl = false; foreach (FORBaseColor bc in list) { if (row["Title"].ToString() == bc.Title) { bl = true; FORBaseColor bc1 = new FORBaseColor(); bc1.Color1 = Color.Blue; CopyBaseColor(bc1, bc); li.Add(bc1); } } if (!bl) { FORBaseColor bc1 = new FORBaseColor(); bc1.UID = Guid.NewGuid().ToString(); bc1.Remark = this.forecastReport.ID.ToString() + "-" + typeFlag; bc1.Title = row["Title"].ToString(); bc1.Color = 16711680; bc1.Color1 = Color.Blue; Services.BaseService.Create<FORBaseColor>(bc1); li.Add(bc1); } } ArrayList ht = new ArrayList(); foreach (FORBaseColor bc2 in li) { ht.Add(bc2.Color1); } List<Ps_Forecast_Math> listValues = new List<Ps_Forecast_Math>(); for (int i = 0; i < this.dataTable.Rows.Count; i++) { DataRow row = this.dataTable.Rows[i]; foreach (TreeListColumn col in treeList1.Columns) { if (col.FieldName.IndexOf("y") > -1) { object obj = row[col.FieldName]; if (obj != DBNull.Value) { Ps_Forecast_Math v = new Ps_Forecast_Math(); v.ForecastID = forecastReport.ID; v.ID = (string)row["ID"]; v.Title = row["Title"].ToString(); v.Sort = Convert.ToInt32(col.FieldName.Replace("y", "")); v.y1990 = (double)row[col.FieldName]; listValues.Add(v); } } } } chart1.Series.Clear(); ArrayList al = new ArrayList(); al.Add(Application.StartupPath + "/img/1.ico"); al.Add(Application.StartupPath + "/img/2.ico"); al.Add(Application.StartupPath + "/img/3.ico"); al.Add(Application.StartupPath + "/img/4.ico"); al.Add(Application.StartupPath + "/img/5.ico"); al.Add(Application.StartupPath + "/img/6.ico"); al.Add(Application.StartupPath + "/img/7.ico"); chart1.DataBindCrossTab(listValues, "Title", "Sort", "y1990", ""); LegendItem legendItem; LegendCell legendCell1; LegendCell legendCell2; LegendCell legendCell3; Legend legend = new Legend(); legend.AutoFitText = false; //legend.BackColor = System.Drawing.Color.Transparent; //legend.BorderColor = System.Drawing.Color.FromArgb(((System.Byte)(64)), ((System.Byte)(64)), ((System.Byte)(64)), ((System.Byte)(64))); for (int i = 0; i < chart1.Series.Count; i++) { int j = i % 10; legendItem = new Dundas.Charting.WinControl.LegendItem(); legendCell1 = new Dundas.Charting.WinControl.LegendCell(); legendCell2 = new Dundas.Charting.WinControl.LegendCell(); legendCell3 = new Dundas.Charting.WinControl.LegendCell(); legendCell1.CellType = Dundas.Charting.WinControl.LegendCellType.Image; legendCell2.CellType = Dundas.Charting.WinControl.LegendCellType.Image; legendCell1.Name = "Cell1"; legendCell2.Name = "Cell2"; legendCell3.Alignment = System.Drawing.ContentAlignment.MiddleLeft; legendCell3.Name = "Cell3"; legendCell3.Text = chart1.Series[i].Name; legendCell3.TextColor = (Color)ht[i]; chart1.Series[i].Color = (Color)ht[i]; chart1.Series[i].Name = (i + 1).ToString() + "." + chart1.Series[i].Name; chart1.Series[i].Type = Dundas.Charting.WinControl.SeriesChartType.Line; chart1.Series[i].MarkerImage = al[i % 7].ToString(); chart1.Series[i].MarkerSize = 7; chart1.Series[i].MarkerStyle = (Dundas.Charting.WinControl.MarkerStyle)(2); chart1.Series[i].ShowInLegend = false; chart1.Series[i].Enabled = true; chart1.Series[i].XValueIndexed = true; legendItem.Cells.Add(legendCell1); legendItem.Cells.Add(legendCell2); legendItem.Cells.Add(legendCell3); legendItem.Tag = chart1.Series[i]; legendItem.Cells[1].Image = al[i % 7].ToString(); if (checkBox1.Checked) { legendItem.Cells[0].Image = string.Format(Application.StartupPath + @"/img/chk_checked.png"); } else { legendItem.Cells[0].Image = string.Format(Application.StartupPath + @"/img/chk_unchecked.png"); } legend.CustomItems.Add(legendItem); chart1.Series[i].Enabled = checkBox1.Checked; } chart1.ChartAreas["Default"].AxisY.MinorGrid.Enabled = true; chart1.ChartAreas["Default"].AxisY.MinorGrid.LineStyle = ChartDashStyle.Dash; chart1.ChartAreas["Default"].AxisY.MinorGrid.LineColor = Color.Gray; legend.Name = "Default"; this.chart1.Legends.Add(legend); }
public string[] _StrSubalgorithm; // = new string[_nComboBoxCount_Subalgorithm];//子算法数组 /// <summary> /// 重新设置是否显示chart控件的多条曲线 /// </summary> /// <param name="_ChartObject">chart对象</param> /// <param name="_CheckBoxObject">checkBox对象</param> /// <param name="hs">存放颜色数组</param> /// <param name="al">存放图片的数组</param> public void SetChart(Dundas.Charting.WinControl.Chart _ChartObject, System.Windows.Forms.CheckBox _CheckBoxObject, ArrayList hs, ArrayList al) { LegendItem legendItem; LegendCell legendCell1; LegendCell legendCell2; LegendCell legendCell3; Legend legend = new Legend(); legend.AutoFitText = false; if (al == null) { al = new ArrayList(); AddIco(al); } if (_ChartObject != null && _CheckBoxObject != null) { for (int i = 0; i < _ChartObject.Series.Count; ++i) { legendItem = new Dundas.Charting.WinControl.LegendItem(); legendCell1 = new Dundas.Charting.WinControl.LegendCell(); legendCell1.CellType = Dundas.Charting.WinControl.LegendCellType.Image; legendCell1.Name = "Cell1"; legendCell2 = new Dundas.Charting.WinControl.LegendCell(); legendCell3 = new Dundas.Charting.WinControl.LegendCell(); legendCell3.CellType = Dundas.Charting.WinControl.LegendCellType.Image; legendCell3.Name = "Cell3"; legendCell2.Name = "Cell2"; legendCell2.Alignment = System.Drawing.ContentAlignment.MiddleLeft; legendCell2.Text = _ChartObject.Series[i].Name; if (hs != null) { legendCell2.TextColor = (Color)hs[i]; _ChartObject.Series[i].Color = (Color)hs[i]; } _ChartObject.Series[i].Name = (i + 1).ToString() + "." + _ChartObject.Series[i].Name; _ChartObject.Series[i].Type = Dundas.Charting.WinControl.SeriesChartType.Line; _ChartObject.Series[i].MarkerImage = al[i % 7].ToString(); _ChartObject.Series[i].MarkerSize = 7; _ChartObject.Series[i].MarkerStyle = (Dundas.Charting.WinControl.MarkerStyle)(2); _ChartObject.Series[i].ShowInLegend = false; legendItem.Cells.Add(legendCell1); legendItem.Cells.Add(legendCell2); legendItem.Tag = _ChartObject.Series[i]; if (_CheckBoxObject.Checked) { legendItem.Cells[0].Image = string.Format(Application.StartupPath + @"/img/chk_checked.png"); } else { legendItem.Cells[0].Image = string.Format(Application.StartupPath + @"/img/chk_unchecked.png"); } legend.CustomItems.Add(legendItem); _ChartObject.Series[i].Enabled = _CheckBoxObject.Checked; } _ChartObject.ChartAreas["Default"].AxisX.MinorGrid.Enabled = false; _ChartObject.ChartAreas["Default"].AxisY.MinorGrid.Enabled = true; _ChartObject.ChartAreas["Default"].AxisY.MinorGrid.LineStyle = ChartDashStyle.Dash; _ChartObject.ChartAreas["Default"].AxisY.MinorGrid.LineColor = Color.Gray; legend.Name = "Default"; _ChartObject.Legends.Add(legend); } }