public void DrawPolarPlot(double[] mag1, double[] ang1) { try { RemovePreviousObjects(); chartVu = this; Font theLabelFont = new Font("Courier", 10, FontStyle.Regular); string[] sarrxlab = new string[mag1.Length]; int nump1 = mag1.Length; for (int i = 0; i < nump1; i++) { sarrxlab[i] = "Mag " + mag1[i].ToString() + ", Angle " + ang1[i].ToString(); ang1[i] = ChartSupport.ToRadians((double)ang1[i]); } theFont = new Font("Microsoft Sans Serif", 10, FontStyle.Bold); chartVu = this; SimpleDataset Dataset1 = new SimpleDataset("First", mag1, ang1); pPolarTransform = new PolarCoordinates(); pPolarTransform.SetGraphBorderDiagonal(0.25, .2, .75, 0.8); background = new Background(pPolarTransform, ChartObj.GRAPH_BACKGROUND, GraphBG1, GraphBG2, GraphBGDir); chartVu.AddChartObject(background); plotbackground = new Background(pPolarTransform, ChartObj.PLOT_BACKGROUND, ChartBG1, ChartBG2, ChartBGDir); chartVu.AddChartObject(plotbackground); pPolarTransform.AutoScale(Dataset1); pPolarAxis = pPolarTransform.GetCompatibleAxes(); pPolarAxis.SetColor(_AxisColor); chartVu.AddChartObject(pPolarAxis); pPolarGrid = new PolarGrid(pPolarAxis, PolarGrid.GRID_MAJOR); pPolarGrid.SetColor(_AxisColor); chartVu.AddChartObject(pPolarGrid); pPolarAxisLabels = (PolarAxesLabels)pPolarAxis.GetCompatibleAxesLabels(); pPolarAxisLabels.SetColor(_AxisColor); chartVu.AddChartObject(pPolarAxisLabels); ChartAttribute attrib1 = new ChartAttribute(Color.Blue, 2, 0); ChartAttribute attrib2 = new ChartAttribute(Color.Red, .5, 0, Color.Red); attrib2.SetFillFlag(true); thePlot2 = new PolarScatterPlot(pPolarTransform, Dataset1, ChartObj.CIRCLE, attrib2); chartVu.AddChartObject(thePlot2); PolarLinePlot thePlot1 = new PolarLinePlot(pPolarTransform, Dataset1, attrib1); chartVu.AddChartObject(thePlot1); findObj = new CustomFindObj1(chartVu, sarrxlab); findObj.SetDataToolTipFormat(ChartObj.DATA_TOOLTIP_CUSTOM); findObj.SetEnable(true); chartVu.SetCurrentMouseListener(findObj); if (_ChartFooter != null) { ChartTitle footer = new ChartTitle(pPolarTransform, theFont, _ChartFooter); footer.SetColor(Color.Black); footer.SetTitleType(ChartObj.CHART_FOOTER); footer.SetTitlePosition(ChartObj.CENTER_GRAPH); footer.SetTitleOffset(8); chartVu.AddChartObject(footer); } this.SetResizeMode(ChartObj.NO_RESIZE_OBJECTS); } catch (Exception ex) { } }
public void BackGroundChanges() { try { if (chartVu != null) { ArrayList arrObjects = chartVu.GetChartObjectsArrayList(); int iCount = arrObjects.Count; int iDel = 0; if (arrObjects != null) { for (int iCtr = 0; iCtr < iCount; iCtr++) { GraphObj objObject = (GraphObj)arrObjects[iDel]; Type obj = objObject.GetType(); if (obj.Name == "PolarLinePlot" || obj.Name == "PolarScatterPlot") { iDel++; } else { chartVu.DeleteChartObject(objObject); } } } plotbackground = new Background(pPolarTransform, ChartObj.PLOT_BACKGROUND, ChartBG1, ChartBG2, ChartBGDir); chartVu.AddChartObject(plotbackground); background = new Background(pPolarTransform, ChartObj.GRAPH_BACKGROUND, GraphBG1, GraphBG2, GraphBGDir); chartVu.AddChartObject(background); pPolarAxis = pPolarTransform.GetCompatibleAxes(); pPolarAxis.SetColor(_AxisColor); chartVu.AddChartObject(pPolarAxis); pPolarGrid = new PolarGrid(pPolarAxis, PolarGrid.GRID_MAJOR); pPolarGrid.SetColor(_AxisColor); pPolarGrid.LineColor = _AxisColor; chartVu.AddChartObject(pPolarGrid); pPolarAxisLabels = (PolarAxesLabels)pPolarAxis.GetCompatibleAxesLabels(); pPolarAxisLabels.SetColor(_AxisColor); chartVu.AddChartObject(pPolarAxisLabels); if (_ChartFooter != null) { ChartTitle footer = new ChartTitle(pPolarTransform, theFont, _ChartFooter); footer.SetColor(_AxisColor); footer.SetTitleType(ChartObj.CHART_FOOTER); footer.SetTitlePosition(ChartObj.CENTER_GRAPH); footer.SetTitleOffset(8); chartVu.AddChartObject(footer); } chartVu.Update(); } } catch (Exception ex) { } }
internal void SetDataCursor() { try { m_objDataCursor = new DataCursor(m_objChartView, m_objCartesianCordinates, GraphObj.MARKER_VLINE, 8.0); m_objDataCursor.SetColor(Color.Black); m_objDataCursor.SetEnable(true); m_objDataCursor.LineStyle = DashStyle.Solid; m_objDataCursor.SetLineStyle(DashStyle.Solid); m_objDataCursor.LineColor = Color.Black; m_objChartView.SetCurrentMouseListener(m_objDataCursor); m_objChartView.AddChartObject(m_objDataCursor); if (m_objMarker != null) { m_objChartView.DeleteChartObject(m_objMarker); m_objChartView.UpdateDraw(); } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message, ex.StackTrace); } finally { } }