/// <summary> /// Change ChartType (HR, Power, Cadence, etc.) from menu /// </summary> /// <param name="sender">menu item that was clicked</param> /// <param name="e">This item is not used</param> private void DetailMenuItem_Click(object sender, EventArgs e) { ToolStripMenuItem selected = sender as ToolStripMenuItem; for (int i = 0; i < mnuDetail.Items.Count; i++) { ToolStripMenuItem item = mnuDetail.Items[i] as ToolStripMenuItem; if (item != null) { if (item != selected) { item.Checked = false; } else { item.Checked = true; } } else { // ToolStrip Separator encountered. Stop evaluating break; } } ChartBanner.Text = selected.Text.ToString(); ChartType = (Common.ChartBasis)Enum.Parse(typeof(Common.ChartBasis), selected.Tag.ToString()); }
//private Graphics lockGraphic; //private Activation pageActivate; #endregion #region Constructor internal ActivityComparerDetailControl() { InitializeComponent(); // Setup button images SaveImageButton.CenterImage = CommonResources.Images.Save16; RefreshButton.CenterImage = CommonResources.Images.Refresh16; ZoomInButton.CenterImage = CommonResources.Images.ZoomIn16; ZoomOutButton.CenterImage = CommonResources.Images.ZoomOut16; ZoomChartButton.CenterImage = Resources.Images.ZoomFit; ExtraChartsButton.CenterImage = Resources.Images.Charts; ExportButton.CenterImage = CommonResources.Images.Export16; MaximizeButton.CenterImage = Resources.Images.PanelExpand; chartType = Common.ChartBasis.Power; ChartBanner.Text = CommonResources.Text.LabelPower; zedChart.GraphPane.XAxis.ScaleFormatEvent += new Axis.ScaleFormatHandler(XScaleFormatEvent); zedChart.PointValueEvent += new ZedGraphControl.PointValueHandler(zedChart_PointValueEvent); control = this; // Setup tool tips // Create the ToolTip and associate with the Form container. ToolTip toolTip = new ToolTip(); // Set up the delays for the ToolTip. toolTip.AutoPopDelay = 5000; toolTip.InitialDelay = 1000; toolTip.ReshowDelay = 500; // Force the ToolTip text to be displayed whether or not the form is active. toolTip.ShowAlways = true; // Set up the ToolTip text for the Button and Checkbox. toolTip.SetToolTip(this.SaveImageButton, CommonResources.Text.ActionSave); toolTip.SetToolTip(this.ZoomInButton, CommonResources.Text.ActionZoomIn); toolTip.SetToolTip(this.ZoomOutButton, CommonResources.Text.ActionZoomOut); toolTip.SetToolTip(this.ZoomChartButton, "Fit to Window"); toolTip.SetToolTip(this.ExtraChartsButton, "More Charts"); toolTip.SetToolTip(this.RefreshButton, CommonResources.Text.ActionRefresh); toolTip.SetToolTip(this.ExportButton, CommonResources.Text.ActionExport); }
/// <summary> /// Add 'track' to 'graph' and apply labels based on 'chartType' /// </summary> /// <param name="track">Data track</param> /// <param name="graph">Which graph to stick the data on</param> /// <param name="chartType">This determines the labeling, coloring, etc. (all appearance related)</param> internal static void updateZedGraph(INumericTimeDataSeries track, ZedGraphControl graph, Common.ChartBasis chartType) { GraphPane myPane = graph.GraphPane; myPane.XAxis.Title.Text = CommonResources.Text.LabelTime; myPane.XAxis.Type = AxisType.Log; Color mainCurveColor = Color.FromArgb(204, 0, 0); switch (chartType) { case Common.ChartBasis.Cadence: mainCurveColor = Common.ColorCadence; myPane.YAxis.Title.Text = CommonResources.Text.LabelCadence; break; case Common.ChartBasis.HR: mainCurveColor = Common.ColorHR; myPane.YAxis.Title.Text = CommonResources.Text.LabelHeartRate + " " + CommonResources.Text.LabelBPM; break; case Common.ChartBasis.Power: mainCurveColor = Common.ColorPower; myPane.YAxis.Title.Text = CommonResources.Text.LabelPower; break; } myPane.XAxis.MinorTic.IsOutside = true; PointPairList zedTrack = new PointPairList(); foreach (ITimeValueEntry <float> item in track) { zedTrack.Add(item.ElapsedSeconds, item.Value); } myPane.CurveList.Clear(); LineItem curve = myPane.AddCurve("Curve Label", zedTrack, mainCurveColor, SymbolType.None); curve.Line.Width = 2f; curve.Line.Fill.Type = FillType.Solid; curve.Line.Fill.Color = Color.FromArgb(50, mainCurveColor); myPane.YAxis.Title.FontSpec.FontColor = mainCurveColor; myPane.YAxis.Scale.FontSpec.FontColor = mainCurveColor; graph.AxisChange(); graph.Refresh(); }