public TickValue(double dfVal, ConfigurationAxis config) { m_config = config; m_plot = null; m_dfVal = dfVal; m_strValue = GetValueString(); }
public static ConfigurationFrame Deserialize(XElement elm) { ConfigurationFrame frame = new ConfigurationFrame(); frame.m_nDataIndex = SerializeToXml.LoadInt(elm, "DataIndex").Value; frame.m_nFrameHeight = SerializeToXml.LoadInt(elm, "FrameHeight").Value; frame.m_clrTitle = SerializeToXml.LoadColor(elm, "TitleColor").Value; frame.m_fontTitle = SerializeToXml.LoadFont(elm, "TitleFont"); frame.Name = SerializeToXml.LoadText(elm, "Name"); frame.Visible = SerializeToXml.LoadBool(elm, "Visible").Value; frame.MinMaxTarget = (PlotCollection.MINMAX_TARGET)SerializeToXml.LoadInt(elm, "MinMaxTarget"); frame.ScaleToVisibleWhenRelative = SerializeToXml.LoadBool(elm, "ScaleToVisible").Value; frame.m_rgPlots = ConfigurationPlot.Deserialize(elm.Descendants()); frame.m_rgLines = ConfigurationTargetLine.Deserialize(elm.Descendants()); frame.m_configPlotArea = ConfigurationPlotArea.Deserialize(elm); frame.m_configXAxis = ConfigurationAxis.Deserialize(elm, "X"); frame.m_configYAxis = ConfigurationAxis.Deserialize(elm, "Y"); double?dfVal = SerializeToXml.LoadDouble(elm, "MinYRange"); if (dfVal.HasValue) { frame.MinimumYRange = dfVal.Value; } return(frame); }
public ConfigurationAxis Clone() { ConfigurationAxis c = new ConfigurationAxis(); c.m_clrZeroLine = m_clrZeroLine; c.m_clrTick = m_clrTick; c.m_clrLabel = m_clrLabel; c.m_fontLabel = new Font(m_fontLabel, FontStyle.Regular); c.m_fontLabelBold = new Font(m_fontLabelBold, FontStyle.Bold); c.m_bVisible = m_bVisible; c.m_dfInitialMin = m_dfInitialMin; c.m_dfInitialMax = m_dfInitialMax; c.m_nMargin = m_nMargin; c.m_nPlotSpacing = m_nPlotSpacing; c.m_fPlotSpacing = m_fPlotSpacing; c.m_nDecimals = m_nDecimals; c.m_bShowAllNumbers = m_bShowAllNumbers; c.m_valueType = m_valueType; c.m_valueRes = m_valueRes; c.m_dfTimeOffsetInHours = m_dfTimeOffsetInHours; c.m_bShowSeconds = m_bShowSeconds; c.m_bShowHourSeparators = m_bShowHourSeparators; c.m_fPlotValueIncrements = m_fPlotValueIncrements; c.m_fPlotValueSubIncrements = m_fPlotValueSubIncrements; c.m_fPlotValueIncrementFloor = m_fPlotValueIncrementFloor; c.m_nDataIdxForAxisLabel = m_nDataIdxForAxisLabel; return(c); }
public GraphAxisStyle(ConfigurationAxis c) { m_penZeroLine = new Pen(c.ZeroLineColor, 1.0f); m_penTick = new Pen(c.TickColor, 1.0f); m_brLabel = new SolidBrush(c.LabelColor); Color clr = Color.FromArgb(128, Color.Lavender); m_brHourLabel = new SolidBrush(clr); }
public ConfigurationFrame(SerializationInfo info, StreamingContext context) { int nCount = info.GetInt32("plotCount"); for (int i = 0; i < nCount; i++) { ConfigurationPlot plot = (ConfigurationPlot)info.GetValue("plot_" + i.ToString(), typeof(ConfigurationPlot)); m_rgPlots.Add(plot); } nCount = info.GetInt32("targetLineCount"); for (int i = 0; i < nCount; i++) { ConfigurationTargetLine line = (ConfigurationTargetLine)info.GetValue("targetline_" + i.ToString(), typeof(ConfigurationTargetLine)); m_rgLines.Add(line); } m_configPlotArea = (ConfigurationPlotArea)info.GetValue("plotArea", typeof(ConfigurationPlotArea)); m_configXAxis = (ConfigurationAxis)info.GetValue("axisX", typeof(ConfigurationAxis)); m_configYAxis = (ConfigurationAxis)info.GetValue("axisY", typeof(ConfigurationAxis)); m_nDataIndex = info.GetInt32("plotCollectionIdx"); m_nFrameHeight = info.GetInt32("frameHeight"); m_clrTitle = (Color)info.GetValue("clrTitle", typeof(Color)); m_fontTitle = (Font)info.GetValue("fontTitle", typeof(Font)); m_strName = info.GetString("name"); m_bVisible = info.GetBoolean("visible"); try { m_minmaxTarget = (PlotCollection.MINMAX_TARGET)info.GetInt32("minmax_target"); } catch (Exception) { } try { m_bScaleToVisibleWhenRelative = info.GetBoolean("scale_to_visible"); } catch (Exception) { } try { m_dfMinYRange = info.GetDouble("min_y_range"); } catch (Exception) { } }
private GraphAxisStyle createStyle(ConfigurationAxis c) { if (m_style != null && m_config != null && m_config.Compare(c)) { return(m_style); } if (m_style != null) { m_style.Dispose(); } m_config = c; return(new SimpleGraphing.GraphAxisStyle(m_config)); }
public ConfigurationFrame(ConfigurationFrame f) { m_configPlotArea = new ConfigurationPlotArea(f.m_configPlotArea); m_configXAxis = f.m_configXAxis.Clone(); m_configYAxis = f.m_configYAxis.Clone(); m_nDataIndex = f.m_nDataIndex; m_nFrameHeight = f.m_nFrameHeight; m_clrTitle = f.m_clrTitle; m_fontTitle = new Font(f.m_fontTitle, FontStyle.Bold); m_strName = f.m_strName; m_bVisible = f.m_bVisible; m_dfMarginPercent = f.m_dfMarginPercent; m_minmaxTarget = f.m_minmaxTarget; m_bScaleToVisibleWhenRelative = f.m_bScaleToVisibleWhenRelative; m_dfMinYRange = f.m_dfMinYRange; m_rcActivePlotAreaBounds = f.m_rcActivePlotAreaBounds; m_bUseExistingDataMinMax = f.m_bUseExistingDataMinMax; }
public TickValue(Plot p, TYPE type, ConfigurationAxis config, double dfLastVal, ref int nDayCount, ref int nDayLast) { m_config = config; m_plot = p; m_type = type; m_dfVal = (type == TYPE.X) ? p.X : p.Y; m_nDayCount = nDayCount; m_nDayLast = nDayLast; m_dfLastVal = dfLastVal; m_dt = DateTime.FromFileTime((long)m_dfVal); if (m_dfLastVal > 0) { m_dtLast = DateTime.FromFileTime((long)m_dfLastVal); } m_strValue = GetValueString(); nDayCount = DayCount; nDayLast = DayLast; }
public static ConfigurationAxis Deserialize(XElement elm, string strType) { ConfigurationAxis axis = new ConfigurationAxis(); XElement child = SerializeToXml.GetElement(elm.Descendants(), "Axis" + strType); axis.ZeroLineColor = SerializeToXml.LoadColor(child, "ZeroLineColor").Value; axis.TickColor = SerializeToXml.LoadColor(child, "TickColor").Value; axis.LabelColor = SerializeToXml.LoadColor(child, "LabelColor").Value; axis.LabelFont = SerializeToXml.LoadFont(child, "LabelFont"); axis.Visible = SerializeToXml.LoadBool(child, "Visible").Value; axis.InitialMinimum = SerializeToXml.LoadDouble(child, "InitialMin").Value; axis.InitialMaximum = SerializeToXml.LoadDouble(child, "InitialMax").Value; axis.Margin = (uint)SerializeToXml.LoadInt(child, "Margin").Value; axis.PlotSpacing = SerializeToXml.LoadInt(child, "PlotSpacing").Value; axis.Decimals = SerializeToXml.LoadInt(child, "Decimals").Value; axis.ShowAllNumbers = SerializeToXml.LoadBool(child, "ShowAllNumbers").Value; axis.ValueType = valueTypeFromString(SerializeToXml.LoadText(child, "ValueType")); axis.ValueResolution = valueResFromString(SerializeToXml.LoadText(child, "ValueRes")); axis.TimeOffsetInHours = SerializeToXml.LoadDouble(child, "TimeOffsetInHours").Value; bool?bShowSeconds = SerializeToXml.LoadBool(child, "ShowSeconds"); if (bShowSeconds.HasValue) { axis.ShowSeconds = bShowSeconds.Value; } bool?bShowHourSeparators = SerializeToXml.LoadBool(child, "ShowHourSeparators"); if (bShowHourSeparators.HasValue) { axis.ShowHourSeparators = bShowHourSeparators.Value; } return(axis); }
public bool Compare(ConfigurationAxis c) { if (m_clrZeroLine != c.m_clrZeroLine) { return(false); } if (m_clrTick != c.m_clrTick) { return(false); } if (m_clrLabel != c.m_clrLabel) { return(false); } if (m_fontLabel.Name != c.m_fontLabel.Name || m_fontLabel.Size != c.m_fontLabel.Size || m_fontLabel.Style != c.m_fontLabel.Style) { return(false); } if (m_bVisible != c.m_bVisible) { return(false); } if (m_dfInitialMax != c.m_dfInitialMax) { return(false); } if (m_dfInitialMin != c.m_dfInitialMin) { return(false); } if (m_nMargin != c.m_nMargin) { return(false); } if (m_nDecimals != c.m_nDecimals) { return(false); } if (m_bShowAllNumbers != c.m_bShowAllNumbers) { return(false); } if (m_valueType != c.m_valueType) { return(false); } if (m_valueRes != c.m_valueRes) { return(false); } if (m_dfTimeOffsetInHours != c.m_dfTimeOffsetInHours) { return(false); } if (m_bShowSeconds != c.m_bShowSeconds) { return(false); } if (m_fPlotValueIncrements != c.m_fPlotValueIncrements) { return(false); } if (m_fPlotValueSubIncrements != c.m_fPlotValueSubIncrements) { return(false); } if (m_nDataIdxForAxisLabel != c.m_nDataIdxForAxisLabel) { return(false); } return(true); }
public override void BuildGraph(ConfigurationAxis config, PlotCollectionSet data) { base.BuildGraph(config, data); Resize(m_rcBounds.X, m_rcBounds.Y, m_rcBounds.Width, m_rcBounds.Height); }
public string GetValueString(bool?bLabelVisible = null, DateTime?dtLastVisible = null) { ConfigurationAxis config = m_config; double dfVal = m_dfVal; if (config.ValueType == ConfigurationAxis.VALUE_TYPE.TIME) { if (m_dfLastVal != 0) { if (m_dt.Hour != m_dtLast.Hour) { m_bNewHour = true; } else { m_bNewHour = false; } if (m_config.ShowHourSeparators && m_bNewHour) { m_style = FontStyle.Bold; } } if (config.ValueResolution == ConfigurationAxis.VALUE_RESOLUTION.DAY) { return(m_dt.ToShortDateString()); } else if (config.ValueResolution == ConfigurationAxis.VALUE_RESOLUTION.DAY_MONTH) { return(formatDayMonth(m_dt, bLabelVisible, dtLastVisible)); } else { if (config.TimeOffsetInHours > 0) { m_dt += TimeSpan.FromHours(config.TimeOffsetInHours); } if (m_dt.Day != m_nDayLast) { m_nDayLast = m_dt.Day; m_nDayCount = 0; } m_nDayCount++; if (m_nDayCount <= 2) { m_style = FontStyle.Bold; m_nDayLast = m_dt.Day; string strVal = m_dt.Day.ToString("00") + " " + m_dt.Hour.ToString("00") + ":" + m_dt.Minute.ToString("00"); if (config.ShowSeconds) { strVal += ":" + m_dt.Second.ToString("00"); } return(strVal); } else { string strVal = m_dt.Hour.ToString("00") + ":" + m_dt.Minute.ToString("00"); if (config.ShowSeconds) { strVal += ":" + m_dt.Second.ToString("00"); } return(strVal); } } } else { string strFmt = "N" + config.Decimals.ToString(); dfVal = Math.Round(dfVal, m_config.Decimals); return(dfVal.ToString(strFmt)); } }
public virtual void BuildGraph(ConfigurationAxis config, PlotCollectionSet data) { m_data = data; m_style = createStyle(config); }