private void UpdateChart(DataObjectCategory dbo, DataObjectExt dObjExt, Color lineColor) { chartValues.Series.Clear(); if (DataObjectCapabilities.HasCapability(dbo, dObjExt.Protocol)) { double min = dObjExt.GetLogItemMinValue(dbo); double max = dObjExt.GetLogItemMaxValue(dbo); if ((max - min) < 10) { min -= 5; max += 5; } Console.WriteLine("Min " + min.ToString() + " - Max: " + max.ToString()); AddChartSerie(dObjExt.GetLogItems(dbo), dbo.Value.ToString(), lineColor, min, max); } if (chartValues.Series.Count > 0) { chartValues.DataBind(); chartValues.Update(); } }
private void SetLabelInformation(Label lblValue, Label lblMinValue, Label lblMaxValue, Label lblMinTime, Label lblMaxTime, DataObjectExt dObjExt, DataObjectCategory dobjcat) { if (dObjExt.ItemExists(dobjcat) && DataObjectCapabilities.HasCapability(dObjExt.Items[dobjcat.Value].DataObjCategory, dObjExt.Protocol)) { string unit = Common.getSensorValueUnit(dObjExt.Items[dobjcat.Value].SensorType); lblValue.Text = dObjExt.Items[dobjcat.Value].Value.ToString("#.#0") + unit; lblMinValue.Text = dObjExt.Items[dobjcat.Value].MinValue.ToString("#.#0") + unit; lblMaxValue.Text = dObjExt.Items[dobjcat.Value].MaxValue.ToString("#.#0") + unit; lblMinTime.Text = Common.getCurrentDateTimeFormattedNoSec(dObjExt.Items[dobjcat.Value].MinTimepoint); lblMaxTime.Text = Common.getCurrentDateTimeFormattedNoSec(dObjExt.Items[dobjcat.Value].MaxTimepoint); } else { lblValue.Text = " --- "; lblMinValue.Text = " --- "; lblMaxValue.Text = " --- "; lblMinTime.Text = " --- "; lblMaxTime.Text = " --- "; } }
private void CheckCabability(DataObjectExt dobjExt) { cboChartSelection.Items.Clear(); if (DataObjectCapabilities.HasTemperature(dobjExt.Protocol)) { grpBoxTemperature.Enabled = true; cboChartSelection.Items.Add(DataObjectCategory.Temperature.Value); } else { grpBoxTemperature.Enabled = false; } if (DataObjectCapabilities.HasAirPressure(dobjExt.Protocol)) { grpBoxAirPressure.Enabled = true; cboChartSelection.Items.Add(DataObjectCategory.AirPressure.Value); } else { grpBoxAirPressure.Enabled = false; } if (DataObjectCapabilities.HasHeatIndex(dobjExt.Protocol)) { grpBoxHeatIndex.Enabled = true; cboChartSelection.Items.Add(DataObjectCategory.HeatIndex.Value); } else { grpBoxHeatIndex.Enabled = false; } if (DataObjectCapabilities.HasHumidity(dobjExt.Protocol)) { grpBoxHumidity.Enabled = true; cboChartSelection.Items.Add(DataObjectCategory.Humidity.Value); } else { grpBoxHumidity.Enabled = false; } if (DataObjectCapabilities.HasLUX(dobjExt.Protocol)) { grpBoxLUX.Enabled = true; cboChartSelection.Items.Add(DataObjectCategory.LUX.Value); } else { grpBoxLUX.Enabled = false; } if (cboChartSelection.Items.Count > 0) { cboChartSelection.SelectedIndex = 0; } }