float GetTiling(MaterialTiling tiling) { if (tiling.EnableTiling == false || tiling.TileFactor <= 0f) { return(1f); } ChartDivisionInfo inf = mAxis.MainDivisions; if (mIsSubDivisions) { inf = mAxis.SubDivisions; } float length = ChartCommon.GetAutoLength(mParent, mOrientation, inf); return(length / tiling.TileFactor); }
void RemoveText(Text text) { if (text != null) { ChartItemEvents e = text.GetComponent <ChartItemEvents>(); CharItemEffectController control = text.GetComponent <CharItemEffectController>(); if (e != null && control != null) { e.OnMouseLeave.Invoke(e.gameObject); mRemoved.Add(control); } else { ChartCommon.SafeDestroy(text); } } }
public void Clear() { CanvasLegendItem[] items = gameObject.GetComponentsInChildren <CanvasLegendItem>(); for (int i = 0; i < items.Length; i++) { if (items[i] == null || items[i].gameObject == null) { continue; } ChartCommon.SafeDestroy(items[i].gameObject); } for (int i = 0; i < mToDispose.Count; i++) { UnityEngine.Object obj = mToDispose[i]; if (obj != null) { ChartCommon.SafeDestroy(obj); } } mToDispose.Clear(); }
public void DestroyAll() { for (int i = 0; i < mText.Count; i++) { if (mText[i] != null && mText[i].Recycled == false) { if (mText[i].UIText != null) { ChartCommon.SafeDestroy(mText[i].UIText.gameObject); } if (mText[i].RectTransformOverride != null) { ChartCommon.SafeDestroy(mText[i].RectTransformOverride.gameObject); } mText[i].UIText = null; mText[i].RectTransformOverride = null; ChartCommon.SafeDestroy(mText[i].gameObject); } } mText.Clear(); }
/// <summary> /// used internally to get the tiling for a chart axis division /// </summary> /// <param name="parent"></param> /// <param name="orientation"></param> /// <param name="inf"></param> /// <returns></returns> float GetTiling(AnyChart parent, ChartOrientation orientation, ChartDivisionInfo inf) { MaterialTiling tiling = inf.MaterialTiling; if (tiling.EnableTiling == false || tiling.TileFactor <= 0f) { return(1f); } float length = Math.Abs(ChartCommon.GetAutoLength(parent, orientation, inf)); float backLength = ChartCommon.GetAutoLength(parent, orientation); float depth = ChartCommon.GetAutoDepth(parent, orientation, inf); if (inf.MarkBackLength.Automatic == false) { backLength = inf.MarkBackLength.Value; } if (backLength != 0 && depth > 0) { length += Math.Abs(backLength) + Math.Abs(depth); } return(length / tiling.TileFactor); }
// Update is called once per frame void Update() { if (Chart == null) { return; } Vector3 res1, res2; if (Chart.PointToWorldSpace(out res1, point1.x, point1.y)) { if (Chart.PointToWorldSpace(out res2, point2.x, point2.y)) { Vector2 finalPos = (res2 + res1) * 0.5f; Vector2 seperationVector = (res2 - res1).normalized; Vector2 elevationVector = ChartCommon.Perpendicular(seperationVector); TextObject.transform.position = finalPos + SeperationOffset * seperationVector + ElevationOffset * elevationVector; if (Rotate) { TextObject.transform.localRotation = Quaternion.Euler(0f, 0f, Mathf.Rad2Deg * Mathf.Atan2(seperationVector.y, seperationVector.x)); } } } }
public void SetAxis(double scrollOffset, AnyChart parent, AxisBase axis, ChartOrientation axisOrientation, bool isSubDivisions) { mScrollOffset = scrollOffset; raycastTarget = false; color = Color.white; mAxis = axis; mParent = parent; mIsSubDivisions = isSubDivisions; mOrientation = axisOrientation; if (mMesh == null) { mMesh = new CanvasChartMesh(true); mMesh.RecycleText = true; } mMesh.Clear(); if (isSubDivisions) { mAxis.AddMainDivisionToChartMesh(mScrollOffset, mParent, transform, mMesh, mOrientation); } else { mAxis.AddSubdivisionToChartMesh(mScrollOffset, mParent, transform, mMesh, mOrientation); } mTexts = mMesh.CurrentTextObjects; if (mMesh.TextObjects != null) { foreach (BillboardText text in mMesh.TextObjects) { ((IInternalUse)parent).InternalTextController.AddText(text); } } canvasRenderer.materialCount = 1; if (mDispose != null) { ChartCommon.SafeDestroy(mDispose); } float tiling = 1f; if (!isSubDivisions) { if (axis.SubDivisions.Material != null) { mMaterial = axis.SubDivisions.Material; mDispose = new Material(mMaterial); mDispose.hideFlags = HideFlags.DontSave; material = mDispose; tiling = GetTiling(axis.SubDivisions.MaterialTiling); } } else { if (axis.MainDivisions.Material != null) { mMaterial = axis.MainDivisions.Material; mDispose = new Material(mMaterial); mDispose.hideFlags = HideFlags.DontSave; material = mDispose; tiling = GetTiling(axis.MainDivisions.MaterialTiling); } } mTiling = tiling; if (mDispose != null) { if (mDispose.HasProperty("_ChartTiling")) { mDispose.SetFloat("_ChartTiling", tiling); } } SetAllDirty(); Rebuild(CanvasUpdate.PreRender); mMesh.DestoryRecycled(); }
void OnDestroy() { ChartCommon.CleanMesh(null, ref mCleanMesh); ChartCommon.SafeDestroy(mDispose); }
/// <summary> /// sets the axis settings. Calling this method will cause the axisgenerator to create the axis mesh /// </summary> /// <param name="parent"></param> /// <param name="axis"></param> /// <param name="axisOrientation"></param> /// <param name="isSubDivisions"></param> public void SetAxis(double scrollOffset, AnyChart parent, AxisBase axis, ChartOrientation axisOrientation, bool isSubDivisions) { mScroll = scrollOffset; mParent = parent; mAxis = axis; mOrientation = axisOrientation; mIsSubDivision = isSubDivisions; if (mMesh == null) { mMesh = new WorldSpaceChartMesh(2); mMesh.RecycleText = true; } mMesh.Clear(); mMesh.Orientation = axisOrientation; mAxis = axis; if (isSubDivisions) { axis.AddSubdivisionToChartMesh(scrollOffset, parent, transform, mMesh, axisOrientation); } else { axis.AddMainDivisionToChartMesh(scrollOffset, parent, transform, mMesh, axisOrientation); } if (mMesh.TextObjects != null) { foreach (BillboardText text in mMesh.TextObjects) { ((IInternalUse)parent).InternalTextController.AddText(text); } } mTexts = mMesh.CurrentTextObjects; Mesh newMesh = mMesh.Generate(mCreated); mCreated = newMesh; newMesh.hideFlags = HideFlags.DontSave; if (mFilter == null) { mFilter = GetComponent <MeshFilter>(); } mFilter.sharedMesh = newMesh; MeshCollider collider = GetComponent <MeshCollider>(); if (collider != null) { collider.sharedMesh = newMesh; } ChartCommon.CleanMesh(newMesh, ref mCleanMesh); MeshRenderer renderer = GetComponent <MeshRenderer>(); if (renderer != null) { Material m = mAxis.MainDivisions.Material; float tiling = GetTiling(parent, axisOrientation, mAxis.MainDivisions); if (isSubDivisions) { m = mAxis.SubDivisions.Material; tiling = GetTiling(parent, axisOrientation, mAxis.SubDivisions); } mMaterial = m; if (m != null) { ChartCommon.SafeDestroy(mDispose); mDispose = new Material(m); mDispose.hideFlags = HideFlags.DontSave; renderer.sharedMaterial = mDispose; mTiling = tiling; if (mDispose.HasProperty("_ChartTiling")) { mDispose.SetFloat("_ChartTiling", mTiling); } } } mMesh.DestoryRecycled(); }
private void SetMSChart(MatchedData MatchData, string sFileName) { double[] expX = MatchData.MatchedMsDataExp.Select(md => md.Mass).ToArray <double>(); double[] expY = MatchData.MatchedMsDataExp.Select(md => md.IntensityPercentage * 100).ToArray <double>(); double[] theoX = MatchData.MatchedMsDataTheo.Select(md => md.Mass).ToArray <double>(); double[] theoY = MatchData.MatchedMsDataTheo.Select(md => md.Intensity * 100).ToArray <double>(); double[] iPAD = MatchData.MatchedMsDataExp.Select(md => md.IPAD_R).ToArray <double>(); double[] iPMD = MatchData.MatchedMsDataExp.Select(md => md.IPMD_R).ToArray <double>(); double minexpX = 0d; double maxexpX = 0d; double mintheoX = 0d; double maxtheoX = 0d; if (MatchData.MatchedMsDataExp.Count != 0) { minexpX = MatchData.MatchedMsDataExp.Min(md => SetMinValue(md.Mass)); maxexpX = MatchData.MatchedMsDataExp.Max(md => SetMaxValue(md.Mass)); } if (MatchData.MatchedMsDataTheo.Count != 0) { mintheoX = MatchData.MatchedMsDataTheo.Min(md => SetMinValue(md.Mass)); maxtheoX = MatchData.MatchedMsDataTheo.Max(md => SetMaxValue(md.Mass)); } if (minexpX == 0) { minexpX = mintheoX; } ChartCommon chart = new ChartCommon(); if (iPAD.Length != 0) { string chartAreasTopName = "chartAreasTop"; chart.CreateChartAreas(chartAreasTopName); chart.SetChartAreasSetting(chartAreasTopName); chart.SetChartAreasX(chartAreasTopName, Math.Min(minexpX, mintheoX), Math.Max(maxexpX, maxtheoX)); chart.SetChartAreasYInterval(chartAreasTopName, 100); chart.SetChartAreasXInterval(chartAreasTopName, 0.5); chart.ChartE.ChartAreas[chartAreasTopName].Position.Height = 20; chart.ChartE.ChartAreas[chartAreasTopName].Position.Width = 100; chart.ChartE.ChartAreas[chartAreasTopName].Position.X = 0; chart.ChartE.ChartAreas[chartAreasTopName].Position.Y = 0; chart.ChartE.ChartAreas[chartAreasTopName].AxisX.MajorGrid.Enabled = true; chart.ChartE.ChartAreas[chartAreasTopName].AxisX.MajorGrid.LineColor = Color.Transparent; chart.ChartE.ChartAreas[chartAreasTopName].AxisX.MajorTickMark.Enabled = true; chart.ChartE.ChartAreas[chartAreasTopName].AxisX.MajorTickMark.LineColor = Color.Transparent; chart.ChartE.ChartAreas[chartAreasTopName].AxisX.LabelStyle.Enabled = true; chart.ChartE.ChartAreas[chartAreasTopName].AxisX.LineColor = Color.Transparent; chart.ChartE.ChartAreas[chartAreasTopName].AxisX.LabelStyle.ForeColor = Color.Transparent; chart.ChartE.ChartAreas[chartAreasTopName].AxisY.MajorGrid.Enabled = true; chart.ChartE.ChartAreas[chartAreasTopName].AxisY.MajorGrid.LineColor = Color.Transparent; chart.ChartE.ChartAreas[chartAreasTopName].AxisY.MajorTickMark.Enabled = true; chart.ChartE.ChartAreas[chartAreasTopName].AxisY.MajorTickMark.LineColor = Color.Transparent; chart.ChartE.ChartAreas[chartAreasTopName].AxisY.LabelStyle.Enabled = true; chart.ChartE.ChartAreas[chartAreasTopName].AxisY.LineColor = Color.Transparent; chart.ChartE.ChartAreas[chartAreasTopName].AxisY.LabelStyle.ForeColor = Color.Transparent; chart.SetChartAreasYTitle(chartAreasTopName, "Relative Abundance (%)"); chart.ChartE.ChartAreas[chartAreasTopName].AxisY.TitleForeColor = Color.Transparent; string seriesNamePMD_PAD = "iPMD_iPAD"; chart.CreateSeries(seriesNamePMD_PAD, chartAreasTopName, SeriesChartType.Spline, "", Color.Red); chart.ChartE.Series[seriesNamePMD_PAD].IsVisibleInLegend = false; chart.ChartE.Series[seriesNamePMD_PAD].Color = Color.Transparent; if (theoX.Length > 1) { chart.ChartE.Series[seriesNamePMD_PAD].Points.AddXY(theoX[0] - (theoX[1] - theoX[0]), 0); chart.ChartE.Series[seriesNamePMD_PAD].Points[0].Label = "IPAD" + "\n" + "IPMD"; } else { chart.ChartE.Series[seriesNamePMD_PAD].Points.AddXY(theoX[0] - 5, 0); chart.ChartE.Series[seriesNamePMD_PAD].Points[0].Label = "IPAD" + "\n" + "IPMD"; } for (int x = 0; x < theoX.Length; x++) { chart.ChartE.Series[seriesNamePMD_PAD].Points.AddXY(theoX[x], 0); if (iPMD[x] > -10000) { chart.ChartE.Series[seriesNamePMD_PAD].Points[x + 1].Label = ((int)iPAD[x]).ToString() + "\n" + ((int)iPMD[x]).ToString(); } else { chart.ChartE.Series[seriesNamePMD_PAD].Points[x + 1].Label = "".ToString() + "\n" + "".ToString(); } } } string chartAreasName = "chartAreas"; chart.CreateChartAreas(chartAreasName); chart.SetChartAreasSetting(chartAreasName); if (MatchData.MatchedMsDataExp.Count != 0) { chart.SetChartAreasX(chartAreasName, Math.Min(minexpX, mintheoX), Math.Max(maxexpX, maxtheoX)); } else { chart.SetChartAreasX(chartAreasName, mintheoX, maxtheoX); } chart.SetChartAreasY(chartAreasName, 0, 100); chart.SetChartAreasSetting(chartAreasName); chart.SetChartAreasXInterval(chartAreasName, 0.5); chart.SetChartAreasYInterval(chartAreasName, 20); chart.SetChartAreasXTitle(chartAreasName, "m/z"); chart.SetChartAreasYTitle(chartAreasName, "Relative Abundance (%)"); chart.SetChartAreasXMajorTickMark(chartAreasName, true); chart.SetChartAreasYMajorTickMark(chartAreasName, true); chart.ChartE.ChartAreas[chartAreasName].Position.Height = 80; chart.ChartE.ChartAreas[chartAreasName].Position.Width = 100; chart.ChartE.ChartAreas[chartAreasName].Position.Y = 20; string legendName = "legend"; chart.CreateLegend(legendName); if (MatchData.MatchedMsDataExp.Count != 0) { string seriesNameExp = "exp"; chart.CreateSeries(seriesNameExp, chartAreasName, SeriesChartType.Candlestick, legendName, Color.Black); chart.SetSeriesAddPoint(seriesNameExp, expX, expY); chart.SetSeriesAddLegendText(seriesNameExp, "Experimental"); } if (MatchData.MatchedMsDataTheo.Count != 0) { string seriesNameTheo = "theo"; chart.CreateSeries(seriesNameTheo, chartAreasName, SeriesChartType.Point, legendName, Color.Red); chart.SetSeriesAddPoint(seriesNameTheo, theoX, theoY); chart.SetSeriesAddLegendText(seriesNameTheo, "Theoretical"); } chart.ChartE.Size = size; chart.ChartE.SaveImage(sFileName, ChartImageFormat.Jpeg); }
public void AddText(BillboardText billboard) { if (billboard == null) { return; } if (billboard.UIText == null) { return; } mInvalidated = false; mText.Add(billboard); var rect = billboard.Rect; EnsureCanvas(); if (rect == null) { var meshObj = billboard.UIText; TextDirection dir = meshObj.GetComponent <TextDirection>(); if (dir != null) { dir.SetTextController(this); } billboard.parent = null; meshObj.transform.SetParent(transform, false); if (mParent != null) { meshObj.layer = mParent.gameObject.layer; } // meshObj.transform.localRotation = Quaternion.identity; meshObj.transform.position = billboard.transform.position; // meshObj.transform.localScale = new Vector3(1f, 1f, 1f); meshObj.transform.localScale = new Vector3(billboard.Scale * mInnerScale, billboard.Scale * mInnerScale, 1f); } else { TextDirection dir = rect.GetComponent <TextDirection>(); if (dir != null) { dir.SetTextController(this); } GameObject obj = ChartCommon.CreateCanvasChartItem(); RectTransform t = obj.GetComponent <RectTransform>(); obj.AddComponent <Canvas>(); var addUnder = mAddCanvasUnder; if (addUnder == null) { addUnder = gameObject; } obj.transform.SetParent(addUnder.transform, false); obj.transform.localPosition = Vector3.zero; // obj.transform.localRotation = Quaternion.identity; obj.transform.localScale = new Vector3(1f, 1f, 1f); billboard.parent = t; billboard.Rect.SetParent(t, false); if (mParent != null) { obj.layer = mParent.gameObject.layer; billboard.Rect.gameObject.layer = mParent.gameObject.layer; } // billboard.Rect.localRotation = Quaternion.identity; billboard.Rect.localPosition = Vector3.zero; billboard.Rect.localScale = new Vector3(1f, 1f, 1f); // rect.anchoredPosition3D = new Vector3(); if (dir == null) { rect.anchorMin = Vector2.zero; rect.anchorMax = Vector2.zero; } billboard.parent.position = billboard.transform.position; billboard.UIText.transform.localScale = new Vector3(billboard.Scale * mInnerScale, billboard.Scale * mInnerScale, 1f); } //Vector3 scale = new Vector3(1f/transform.lossyScale.x, 1f/transform.lossyScale.y, 1f/transform.lossyScale.z);//SafeCanvas.transform.localScale; //Vector3 scale = SafeCanvas.transform.localScale; //if (mUnderCanvas) // billboard.UIText.transform.localScale = scale; //else // ContentSizeFitter fitter = billboard.UIText.gameObject.GetComponent<ContentSizeFitter>(); // if(fitter == null) // fitter = billboard.UIText.gameObject.AddComponent<ContentSizeFitter>(); // fitter.verticalFit = ContentSizeFitter.FitMode.PreferredSize; // fitter.horizontalFit = ContentSizeFitter.FitMode.PreferredSize; }
private void SetMSChart(MatchedData MatchData,string sFileName) { double[] expX = MatchData.MatchedMsDataExp.Select(md => md.Mass).ToArray<double>(); double[] expY = MatchData.MatchedMsDataExp.Select(md => md.IntensityPercentage * 100).ToArray<double>(); double[] theoX = MatchData.MatchedMsDataTheo.Select(md => md.Mass).ToArray<double>(); double[] theoY = MatchData.MatchedMsDataTheo.Select(md => md.Intensity * 100).ToArray<double>(); double[] iPAD = MatchData.MatchedMsDataExp.Select(md => md.IPAD_R).ToArray<double>(); double[] iPMD = MatchData.MatchedMsDataExp.Select(md => md.IPMD_R).ToArray<double>(); double minexpX = 0d; double maxexpX = 0d; double mintheoX = 0d; double maxtheoX = 0d; if (MatchData.MatchedMsDataExp.Count != 0) { minexpX = MatchData.MatchedMsDataExp.Min(md => SetMinValue(md.Mass)); maxexpX = MatchData.MatchedMsDataExp.Max(md => SetMaxValue(md.Mass)); } if (MatchData.MatchedMsDataTheo.Count != 0) { mintheoX = MatchData.MatchedMsDataTheo.Min(md => SetMinValue(md.Mass)); maxtheoX = MatchData.MatchedMsDataTheo.Max(md => SetMaxValue(md.Mass)); } if (minexpX == 0) minexpX = mintheoX; ChartCommon chart = new ChartCommon(); if (iPAD.Length != 0) { string chartAreasTopName = "chartAreasTop"; chart.CreateChartAreas(chartAreasTopName); chart.SetChartAreasSetting(chartAreasTopName); chart.SetChartAreasX(chartAreasTopName, Math.Min(minexpX, mintheoX), Math.Max(maxexpX, maxtheoX)); chart.SetChartAreasYInterval(chartAreasTopName, 100); chart.SetChartAreasXInterval(chartAreasTopName, 0.5); chart.ChartE.ChartAreas[chartAreasTopName].Position.Height = 20; chart.ChartE.ChartAreas[chartAreasTopName].Position.Width = 100; chart.ChartE.ChartAreas[chartAreasTopName].Position.X = 0; chart.ChartE.ChartAreas[chartAreasTopName].Position.Y = 0; chart.ChartE.ChartAreas[chartAreasTopName].AxisX.MajorGrid.Enabled = true; chart.ChartE.ChartAreas[chartAreasTopName].AxisX.MajorGrid.LineColor = Color.Transparent; chart.ChartE.ChartAreas[chartAreasTopName].AxisX.MajorTickMark.Enabled = true; chart.ChartE.ChartAreas[chartAreasTopName].AxisX.MajorTickMark.LineColor = Color.Transparent; chart.ChartE.ChartAreas[chartAreasTopName].AxisX.LabelStyle.Enabled = true; chart.ChartE.ChartAreas[chartAreasTopName].AxisX.LineColor = Color.Transparent; chart.ChartE.ChartAreas[chartAreasTopName].AxisX.LabelStyle.ForeColor = Color.Transparent; chart.ChartE.ChartAreas[chartAreasTopName].AxisY.MajorGrid.Enabled = true; chart.ChartE.ChartAreas[chartAreasTopName].AxisY.MajorGrid.LineColor = Color.Transparent; chart.ChartE.ChartAreas[chartAreasTopName].AxisY.MajorTickMark.Enabled = true; chart.ChartE.ChartAreas[chartAreasTopName].AxisY.MajorTickMark.LineColor = Color.Transparent; chart.ChartE.ChartAreas[chartAreasTopName].AxisY.LabelStyle.Enabled = true; chart.ChartE.ChartAreas[chartAreasTopName].AxisY.LineColor = Color.Transparent; chart.ChartE.ChartAreas[chartAreasTopName].AxisY.LabelStyle.ForeColor = Color.Transparent; chart.SetChartAreasYTitle(chartAreasTopName, "Relative Abundance (%)"); chart.ChartE.ChartAreas[chartAreasTopName].AxisY.TitleForeColor = Color.Transparent; string seriesNamePMD_PAD = "iPMD_iPAD"; chart.CreateSeries(seriesNamePMD_PAD, chartAreasTopName, SeriesChartType.Spline, "", Color.Red); chart.ChartE.Series[seriesNamePMD_PAD].IsVisibleInLegend = false; chart.ChartE.Series[seriesNamePMD_PAD].Color = Color.Transparent; if (theoX.Length > 1) { chart.ChartE.Series[seriesNamePMD_PAD].Points.AddXY(theoX[0] - (theoX[1] - theoX[0]), 0); chart.ChartE.Series[seriesNamePMD_PAD].Points[0].Label = "IPAD" + "\n" + "IPMD"; } else { chart.ChartE.Series[seriesNamePMD_PAD].Points.AddXY(theoX[0] - 5, 0); chart.ChartE.Series[seriesNamePMD_PAD].Points[0].Label = "IPAD" + "\n" + "IPMD"; } for (int x = 0; x < theoX.Length; x++) { chart.ChartE.Series[seriesNamePMD_PAD].Points.AddXY(theoX[x], 0); if (iPMD[x] > -10000) chart.ChartE.Series[seriesNamePMD_PAD].Points[x + 1].Label = ((int)iPAD[x]).ToString() + "\n" + ((int)iPMD[x]).ToString(); else chart.ChartE.Series[seriesNamePMD_PAD].Points[x + 1].Label = "".ToString() + "\n" + "".ToString(); } } string chartAreasName = "chartAreas"; chart.CreateChartAreas(chartAreasName); chart.SetChartAreasSetting(chartAreasName); if (MatchData.MatchedMsDataExp.Count != 0) chart.SetChartAreasX(chartAreasName, Math.Min(minexpX, mintheoX), Math.Max(maxexpX, maxtheoX)); else chart.SetChartAreasX(chartAreasName, mintheoX, maxtheoX); chart.SetChartAreasY(chartAreasName, 0, 100); chart.SetChartAreasSetting(chartAreasName); chart.SetChartAreasXInterval(chartAreasName, 0.5); chart.SetChartAreasYInterval(chartAreasName, 20); chart.SetChartAreasXTitle(chartAreasName, "m/z"); chart.SetChartAreasYTitle(chartAreasName, "Relative Abundance (%)"); chart.SetChartAreasXMajorTickMark(chartAreasName, true); chart.SetChartAreasYMajorTickMark(chartAreasName, true); chart.ChartE.ChartAreas[chartAreasName].Position.Height = 80; chart.ChartE.ChartAreas[chartAreasName].Position.Width = 100; chart.ChartE.ChartAreas[chartAreasName].Position.Y = 20; string legendName = "legend"; chart.CreateLegend(legendName); if (MatchData.MatchedMsDataExp.Count != 0) { string seriesNameExp = "exp"; chart.CreateSeries(seriesNameExp, chartAreasName, SeriesChartType.Candlestick, legendName, Color.Black); chart.SetSeriesAddPoint(seriesNameExp, expX, expY); chart.SetSeriesAddLegendText(seriesNameExp, "Experimental"); } if (MatchData.MatchedMsDataTheo.Count != 0) { string seriesNameTheo = "theo"; chart.CreateSeries(seriesNameTheo, chartAreasName, SeriesChartType.Point, legendName, Color.Red); chart.SetSeriesAddPoint(seriesNameTheo, theoX, theoY); chart.SetSeriesAddLegendText(seriesNameTheo, "Theoretical"); } chart.ChartE.Size = size; chart.ChartE.SaveImage(sFileName, ChartImageFormat.Jpeg); }