public void LoadUseageData(IEnumerable <UsageStatisticsDataRow> statisticsData) { var colourNumber = 0; var seriesToGraph = new List <GraphSeries>(); foreach (var s in statisticsData) { var pageName = s.PageName; ShowSeries.Add(pageName); var series = new GraphSeries(pageName) { GraphColour = ColorTranslator.FromHtml("#" + GraphingColours.ColourValues[colourNumber]), Displayed = true }; series.Xvalue.Add(pageName); series.Yvalue.Add(s.PageRequests); seriesToGraph.Add(series); colourNumber++; } GraphInformation.SeriesData = seriesToGraph; }
public GraphPt(GraphSeries <T> series, T value, float x, float y) { Value = value; X = x; Y = y; Series = series; }
/// <summary> /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnShown(object sender, EventArgs e) { RefreshTimer.Enabled = true; Program.NetClient.OnServerStateRecieved += ServerStateRecieved; Program.NetClient.RequestServerState(); TagBuilder.OnTagClicked += TagItemClicked; TagBuilder.OnTagsRefreshed += ValidateState; TagBuilder.Attach(addTagToolStripMenuItem); if (BandwithGraph.Series.Length == 0 || BandwithGraph.Series[0] == null) { GraphSeries series = new GraphSeries(); series.Name = "Bandwidth Usage"; series.SlidingWindow = true; series.XAxis.MinLabel = ""; series.XAxis.MaxLabel = "5 Minutes"; series.XAxis.Min = 0; series.XAxis.Max = 5 * 60; series.XAxis.GridInterval = 30; series.YAxis.MinLabel = ""; series.YAxis.MaxLabel = "1 KB/s"; series.YAxis.AutoAdjustMax = true; series.YAxis.FormatMaxLabelAsTransferRate = true; series.MinimumInterval = 1.0f / 2.0f; series.YAxis.Max = 1024L; series.YAxis.GridInterval = series.YAxis.Max / 5; BandwithGraph.Series = new GraphSeries[1] { series }; } }
private static VertexArray CreatePointSeriesVao(GraphSeries <T> series) { // hacky, buffer-based approach. Should be doing diffs/deltas here. var count = series.Points.Count; var capacity = (count * _stride).NextPowerOf2(); var posData = new Vector2[capacity]; var uvData = new Vector2[capacity]; for (var i = 0; i < count; i++) { var p = series.Points[i].Position; for (int j = 0; j < _uvPositions.Length; j++) { posData[i * _stride + j] = p; uvData[i * _stride + j] = _uvPositions[j]; } } var positions = GLFactory.Buffer.ArrayBuffer("Positions", posData); var uvs = GLFactory.Buffer.ArrayBuffer("Uvs", uvData); positions.ElementCount = count * _stride; var vao = GLFactory.VertexArray.FromBuffers($"Series '{series.Name}'", positions, uvs); return(vao); }
public void LoadChart(List <FleetStatusRow> fsd, PercentageDivisorType percentType) { var seriesList = new List <GraphSeries>(); hfPercentageValues.Value = percentType.ToString(); var topics = Enum.GetValues(typeof(AvailabilityTopic)); ShowSeries.Add(TopicTranslation.GetAvailabilityTopicDescription(AvailabilityTopic.Utilization)); ShowSeries.Add(TopicTranslation.GetAvailabilityTopicDescription(AvailabilityTopic.OnRent)); foreach (AvailabilityTopic t in topics) { if (percentType == PercentageDivisorType.Values) { if (t == AvailabilityTopic.Utilization || t == AvailabilityTopic.UtilizationInclOverdue) { continue; } } else { if (t == AvailabilityTopic.OnRent) { continue; } } var seriesName = TopicTranslation.GetAvailabilityTopicDescription(t); var displaySeries = false; if (ShowSeries.Count == 0) { if (t == AvailabilityTopic.Utilization || t == AvailabilityTopic.OnRent) { displaySeries = true; } } else { displaySeries = ShowSeries.Contains(seriesName); } var gs = new GraphSeries(seriesName) { GraphColour = TopicTranslation.GetAvailabilityColour(t), Displayed = displaySeries }; foreach (var f in fsd) { gs.Xvalue.Add(f.Day); var yVal = percentType == PercentageDivisorType.Values ? f.GetValue(t) : f.GetValuePercent(t); gs.Yvalue.Add(yVal); } seriesList.Add(gs); } GraphInformation.SeriesData = seriesList; }
private static unsafe void UpdatePointSeriesVao(VertexArray vao, GraphSeries <T> series) { var count = series.Points.Count; var capacity = vao.ElementCount.NextPowerOf2(); var pointsBuffer = vao.Buffers[0]; var uvBuffer = vao.Buffers[1]; var offsetBytes = new IntPtr(vao.ElementCount * sizeof(Vector2)); var missingElemCount = count - (pointsBuffer.ElementCount / _stride); if (series.InvalidateRenderCache || (count * _stride) > capacity) { // reallocate the buffer: capacity = (count * _stride).NextPowerOf2(); var posData = new Vector2[capacity]; var uvData = new Vector2[capacity]; for (var i = 0; i < count; i++) { var p = series.Points[i].Position; for (int j = 0; j < _uvPositions.Length; j++) { posData[i * _stride + j] = p; uvData[i * _stride + j] = _uvPositions[j]; } } GL.BindBuffer(BufferTarget.ArrayBuffer, pointsBuffer.Handle); GL.BufferData(BufferTarget.ArrayBuffer, capacity * sizeof(Vector2), posData, BufferUsageHint.StaticDraw); GL.BindBuffer(BufferTarget.ArrayBuffer, uvBuffer.Handle); GL.BufferData(BufferTarget.ArrayBuffer, capacity * sizeof(Vector2), uvData, BufferUsageHint.StaticDraw); GL.BindBuffer(BufferTarget.ArrayBuffer, 0); pointsBuffer.ElementCount = count * _stride; } else { var sizeBytes = missingElemCount * sizeof(Vector2) * _stride; var posData = new Vector2[missingElemCount * _stride]; var uvData = new Vector2[missingElemCount * _stride]; for (var i = 0; i < missingElemCount; i++) { var srcIdx = (pointsBuffer.ElementCount / _stride) + i; var p = series.Points[srcIdx].Position; for (int j = 0; j < _uvPositions.Length; j++) { posData[i * _stride + j] = p; uvData[i * _stride + j] = _uvPositions[j]; } } GL.BindBuffer(BufferTarget.ArrayBuffer, pointsBuffer.Handle); GL.BufferSubData(BufferTarget.ArrayBuffer, offsetBytes, sizeBytes, posData); GL.BindBuffer(BufferTarget.ArrayBuffer, uvBuffer.Handle); GL.BufferSubData(BufferTarget.ArrayBuffer, offsetBytes, sizeBytes, uvData); GL.BindBuffer(BufferTarget.ArrayBuffer, 0); } pointsBuffer.ElementCount = (count * _stride); series.InvalidateRenderCache = false; }
private GraphSeries SeriesFromCollector(CollectorHost collector, Color seriesColor, int lastXEntries) { GraphSeries series = null; if (txtTextFilter.Text.Trim().Length < 2 || collector.PathWithoutMP.ContainEx(txtTextFilter.Text)) //if (txtTextFilter.Text.Trim().Length < 2 || collector.PathWithoutMP.ToLower().Contains(txtTextFilter.Text.ToLower())) { string stateValue = ""; float v = 0; if (lastXEntries == 0) { lastXEntries = collector.StateHistory.Count; } series = new GraphSeries(collector.PathWithoutMP, seriesColor); foreach (MonitorState agentState in (from hsm in collector.StateHistory orderby hsm.Timestamp descending select hsm).Take(lastXEntries)) { v = 0; stateValue = agentState.ReadFirstValue(false); if (stateValue != null && float.TryParse(stateValue, out v)) { series.Values.Add(new TimeValue() { Time = agentState.Timestamp, Value = v }); } } v = 0; stateValue = collector.CurrentState.ReadFirstValue(false); if (stateValue != null && float.TryParse(stateValue, out v)) { series.Values.Add(new TimeValue() { Time = collector.CurrentState.Timestamp, Value = v }); } } if (series != null && series.Values != null && series.Values.Count > 0) { return(series); } //else if (series.Values.Count ==1) //{ // series.Name += " (Not enough data)"; // return series; //} else { return(null); } }
private void LoadDifferenceChart(IEnumerable <ForecastedFleetSizeEntity> setA, IEnumerable <ForecastedFleetSizeEntity> setB) { var seriesList = new List <GraphSeries>(); var series = new List <string> { "Forecast Demand Gap", "Demand Gap Scenario A", "Demand Gap Scenario B" }; ShowSeries.AddRange(series.ToArray()); var expectedSeries = new GraphSeries(series[0]) { GraphColour = Color.DarkGreen, Displayed = true }; var expectedWithAddsA = new GraphSeries(series[1]) { GraphColour = Color.DarkOrchid, Displayed = true }; var expectedWithAddsB = new GraphSeries(series[2]) { GraphColour = Color.OrangeRed, Displayed = true }; foreach (var f in setA) { expectedSeries.Xvalue.Add(f.Week); expectedSeries.Yvalue.Add(((double)f.ExpectedFleet - f.UnConstrained)); expectedWithAddsA.Xvalue.Add(f.Week); expectedWithAddsA.Yvalue.Add((double)f.ExpectedWithAdditionPlan - f.UnConstrained); } foreach (var f in setB) { expectedWithAddsB.Xvalue.Add(f.Week); expectedWithAddsB.Yvalue.Add((double)f.ExpectedWithAdditionPlan - f.UnConstrained); } seriesList.Add(expectedSeries); seriesList.Add(expectedWithAddsA); seriesList.Add(expectedWithAddsB); GraphInformation.SeriesData = seriesList; }
private GraphSeries AddWaterfallSeries(AvailabilityTopic series, double total, double value, bool show = true) { var seriesName = TopicTranslation.GetAvailabilityTopicDescription(series); var gs = new GraphSeries(seriesName) { GraphColour = TopicTranslation.GetAvailabilityColour(series), Displayed = show }; gs.Xvalue.Add(seriesName); gs.Yvalue.Add(total); gs.Yvalue.Add(total - value); return(gs); }
public void LoadChart(List <TotalContributionRow> comparisonData) { if (!comparisonData.Any()) { return; } var series = new List <string> { "Expected Revenue", "Scenario A Revenue", "Scenario B Revenue" }; ShowSeries.AddRange(series.ToArray()); var expectedSeries = new GraphSeries(series[0]) { GraphColour = Color.DarkGreen, Displayed = true }; var expectedWithAddsA = new GraphSeries(series[1]) { GraphColour = Color.DarkOrchid, Displayed = true }; var expectedWithAddsB = new GraphSeries(series[2]) { GraphColour = Color.OrangeRed, Displayed = true }; foreach (var f in comparisonData) { var monthName = CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(f.Month); expectedSeries.Xvalue.Add(monthName); expectedSeries.Yvalue.Add((f.ExpectedContribution)); expectedWithAddsA.Xvalue.Add(monthName); expectedWithAddsA.Yvalue.Add(f.ExpectedContributionA); expectedWithAddsB.Xvalue.Add(monthName); expectedWithAddsB.Yvalue.Add(f.ExpectedContributionB); } var seriesList = new List <GraphSeries> { expectedSeries, expectedWithAddsA, expectedWithAddsB }; GraphInformation.SeriesData = seriesList; }
protected override void printData(string [] statValues) { //values are recorded for calculating later AVG and SD recordStatValues(statValues); //only simpleSession int i = 0; //we need to save this transposed foreach (string myValue in statValues) { if (i == 0) { CurrentGraphData.XAxisNames.Add(myValue); } else if (i == 1) { serieAVG.SerieData.Add(myValue); } else if (i == 2) { serieSD.SerieData.Add(myValue); } else if (i == 3) { serieJumps.SerieData.Add(myValue); } if (i == 3) { i = 0; } else { i++; } } //add created series to GraphSeries ArrayList //check don't do it two times if (GraphSeries.Count == 0) { GraphSeries.Add(serieAVG); GraphSeries.Add(serieSD); GraphSeries.Add(serieJumps); } }
public void LoadChart(List <ComparisonRow> comparisonData, ReportType report) { SessionStringName = string.Format("{0}SessionString", report); if (GraphInformation == null) { GraphInformation = new GraphData(); } var seriesList = new List <GraphSeries>(); var tf = new GraphSeries("TotalFleet") { GraphColour = Color.Blue }; var tnr = new GraphSeries("TotalNonRev") { GraphColour = Color.Red }; var re = new GraphSeries("Comments") { GraphColour = Color.Green }; foreach (var cd in comparisonData) { if (cd.Key == "Total") { continue; } tf.Xvalue.Add(cd.Key); tnr.Xvalue.Add(cd.Key); re.Xvalue.Add(cd.Key); tf.Yvalue.Add(cd.FleetCount); tnr.Yvalue.Add(cd.NonRevCount); re.Yvalue.Add(cd.ReasonsEntered); } seriesList.Add(tf); seriesList.Add(tnr); seriesList.Add(re); GraphInformation.SeriesData = seriesList; }
/// <summary> /// Serializes the chart pie. /// </summary> /// <param name="graph">The graph.</param> /// <returns></returns> private static IDictionary <string, object> serializeChartPie(Graph graph) { ArrayList arrayList = new ArrayList(); GraphSeries series = graph.Series[0]; Dictionary <string, object> dictValueToObject = new Dictionary <string, object>(); foreach (GraphAxis graphAxis in series.Axis) { Dictionary <string, object> dictList = new Dictionary <string, object>(); dictList.Add("label", graphAxis.X); dictList.Add("data", graphAxis.Y); arrayList.Add(dictList); } dictValueToObject.Add("Series", arrayList); return(dictValueToObject); }
protected override void printData(string [] statValues) { /* * if one day i found the way of plotting different (single plots) i will use it for the numContinuous */ /* * if(numContinuous != -1) { * int bestPos = findBestContinuous(statValues, numContinuous); * if(bestPos != -1) { * statValues = markBestContinuous(statValues, numContinuous, bestPos); * } * } */ GraphSerie serieTc = new GraphSerie(); GraphSerie serieTv = new GraphSerie(); serieTc.IsLeftAxis = true; serieTv.IsLeftAxis = true; int i = 0; foreach (string myValue in statValues) { if (i == 0) { serieTc.Title = myValue + " " + Catalog.GetString("TC"); serieTv.Title = myValue + " " + Catalog.GetString("TF"); } else if (isTC(i)) { serieTc.SerieData.Add(myValue); } else if (isTF(i)) { serieTv.SerieData.Add(myValue); } i++; } //add created series to GraphSeries ArrayList GraphSeries.Add(serieTc); GraphSeries.Add(serieTv); }
private static VertexArray CreateLineSeriesVao(GraphSeries <T> series) { // hacky, buffer-based approach. Should be doing diffs/deltas here. var count = series.Points.Count; var capacity = count.NextPowerOf2(); var arr = new Vector2[capacity]; for (var i = 0; i < count; i++) { arr[i] = series.Points[i].Position; } var positions = GLFactory.Buffer.ArrayBuffer("Positions", arr); positions.ElementCount = count; var vao = GLFactory.VertexArray.FromBuffers($"Series '{series.Name}'", positions); return(vao); }
protected override void printData(string [] statValues) { /* * if one day i found the way of plotting different (single plots) i will use it for the numContinuous */ /* * if(numContinuous != -1) { * int bestPos = findBestContinuous(statValues, numContinuous); * if(bestPos != -1) { * statValues = markBestContinuous(statValues, numContinuous, bestPos); * } * } */ GraphSerie serieSpeed = new GraphSerie(); serieSpeed.IsLeftAxis = true; int i = 0; foreach (string myValue in statValues) { if (i == 0) { serieSpeed.Title = myValue; } else if (i >= 2) { serieSpeed.SerieData.Add(myValue); } //i==1 is the avg speed, is not used i++; } //add created series to GraphSeries ArrayList GraphSeries.Add(serieSpeed); }
private static unsafe void UpdateLineSeriesVao(VertexArray vao, GraphSeries <T> series) { var count = series.Points.Count; var capacity = vao.ElementCount.NextPowerOf2(); var pointsBuffer = vao.Buffers[0]; GL.BindBuffer(BufferTarget.ArrayBuffer, pointsBuffer.Handle); var offsetBytes = new IntPtr(vao.ElementCount * sizeof(Vector2)); var missingElemCount = count - pointsBuffer.ElementCount; if (series.InvalidateRenderCache || count > capacity) { // reallocate the buffer: capacity = MathHelper.NextPowerOfTwo(count); var allData = new Vector2[capacity]; for (var i = 0; i < Math.Min(capacity, count); i++) { allData[i] = series.Points[i].Position; } GL.BufferData(BufferTarget.ArrayBuffer, capacity * sizeof(Vector2), allData, BufferUsageHint.StaticDraw); pointsBuffer.ElementCount = count; } else { var sizeBytes = missingElemCount * sizeof(Vector2); var newData = new Vector2[missingElemCount]; for (var i = 0; i < missingElemCount; i++) { newData[i] = series.Points[pointsBuffer.ElementCount + i].Position; } GL.BufferSubData(BufferTarget.ArrayBuffer, offsetBytes, sizeBytes, newData); } GL.BindBuffer(BufferTarget.ArrayBuffer, 0); pointsBuffer.ElementCount = count; series.InvalidateRenderCache = false; }
protected override void printData(string [] statValues) { //values are recorded for calculating later AVG and SD recordStatValues(statValues); if (sessions.Count == 1) { int i = 0; bool foundAVG = false; //we need to save this transposed foreach (string myValue in statValues) { if (i == 0) { //don't plot AVG and SD rows if (myValue == Catalog.GetString("AVG")) { foundAVG = true; } else { CurrentGraphData.XAxisNames.Add(myValue); } } else if (i == 1) { if (foundAVG) { serieIndex.Avg = Convert.ToDouble(myValue); } else { serieIndex.SerieData.Add(myValue); } } else if (i == 2) { if (foundAVG) { serieTv.Avg = Convert.ToDouble(myValue); } else { serieTv.SerieData.Add(myValue); } } else if (i == 3) { if (foundAVG) { serieTc.Avg = Convert.ToDouble(myValue); } else { serieTc.SerieData.Add(myValue); } } else if (i == 4) { //correct jumps and time for being displayed if (foundAVG) { //serieJumps.Avg = Convert.ToDouble(myValue) *10; serieJumps.Avg = Convert.ToDouble(myValue); } else { //serieJumps.SerieData.Add( (Convert.ToDouble(myValue) *10).ToString() ); serieJumps.SerieData.Add(myValue); } } else if (i == 5) { //correct jumps and time for being displayed if (foundAVG) { //serieTime.Avg = Convert.ToDouble(myValue) * 10; serieTime.Avg = Convert.ToDouble(myValue); } else { //serieTime.SerieData.Add( (Convert.ToDouble(myValue) *10).ToString() ); serieTime.SerieData.Add(myValue); } } else if (i == 6) { if (foundAVG) { serieFall.Avg = Convert.ToDouble(myValue); } else { serieFall.SerieData.Add(myValue); } } if (foundAVG && i == dataColumns) { //add created series to GraphSeries ArrayList //check don't do it two times if (GraphSeries.Count == 0) { GraphSeries.Add(serieTc); GraphSeries.Add(serieTv); GraphSeries.Add(serieIndex); GraphSeries.Add(serieJumps); GraphSeries.Add(serieTime); GraphSeries.Add(serieFall); } return; } i++; } } else { GraphSerie mySerie = new GraphSerie(); mySerie.IsLeftAxis = true; int i = 0; foreach (string myValue in statValues) { if (myValue == Catalog.GetString("SD")) { return; } if (i == 0) { mySerie.Title = myValue; } else if (i == sessions.Count + 1) //eg, for 2 sessions: [(0)person name, (1)sess1, (2)sess2, (3)AVG] { if (myValue != "-") { mySerie.Avg = Convert.ToDouble(myValue); } } else { mySerie.SerieData.Add(myValue); } i++; } GraphSeries.Add(mySerie); } }
private void LoadControls(bool reloadList = false) { DateTime fromTime = fromDateTimeChooser.SelectedDateTime; DateTime toTime = toDateTimeChooser.SelectedDateTime; DateTime autoStartDateTime = DateTime.Now.AddMinutes(-1); DateTime autoEndDateTime = DateTime.Now; long initialMax = (long)nudinitialMax.Value; long maxValue = 1; List <string> seriesNames = new List <string>(); List <GraphSeries> graphSeriesList = new List <GraphSeries>(); if (reloadList) { List <ListViewItem> list = new List <ListViewItem>(); foreach (CollectorHost collector in SelectedCollectors) { string itemName = $"{collector.PathWithoutMP}"; ListViewItem itm = new ListViewItem(itemName); itm.Tag = collector; try { if (collector.CurrentState != null) { itm.SubItems.Add(collector.CurrentState.ReadPrimaryOrFirstUIValue()); } else { itm.SubItems.Add(""); } itm.ImageIndex = GetItemIcon(collector); } catch (Exception ex) { itm.SubItems.Add(ex.Message); itm.ImageIndex = 10; } list.Add(itm); } lvwCollectorStates.Items.Clear(); lvwCollectorStates.Items.AddRange(list.ToArray()); } else { foreach (ListViewItem lvi in lvwCollectorStates.Items) { if (lvi.Tag is CollectorHost) { CollectorHost collector = (CollectorHost)lvi.Tag; try { if (collector.CurrentState != null) { lvi.SubItems[1].Text = collector.CurrentState.ReadPrimaryOrFirstUIValue(); } else { lvi.SubItems[1].Text = ""; } lvi.ImageIndex = GetItemIcon(collector); } catch (Exception ex) { lvi.SubItems[1].Text = ex.Message; lvi.ImageIndex = 10; } } } } //Making seriesses foreach (CollectorHost collector in SelectedCollectors) { Color seriesColor = seriesColors[graphSeriesList.Count % seriesColors.Count]; GraphSeries series = SeriesFromCollector(collector, seriesColor, (int)nudLastXEntries.Value); if (series != null) { seriesNames.Add(series.Name); float val = series.Values.OrderByDescending(v => v.Value).FirstOrDefault().Value; if (maxValue < val) { maxValue = (long)val; } DateTime firstTime = series.Values.OrderBy(v => v.Time).FirstOrDefault().Time; if (autoStartDateTime > firstTime) { autoStartDateTime = firstTime; } graphSeriesList.Add(series); } } if (chkAutoFromTime.Checked) { fromTime = DateTime.Now; foreach (CollectorHost collector in SelectedCollectors) { if (collector.StateHistory != null && collector.StateHistory.Count > 0) { MonitorState mp = collector.StateHistory.OrderBy(h => h.Timestamp).FirstOrDefault(); if (fromTime > mp.Timestamp) { fromTime = mp.Timestamp; } } } fromDateTimeChooser.SelectedDateTime = fromTime; } if (chkAutoToTime.Checked) { toTime = DateTime.Now; toDateTimeChooser.SelectedDateTime = toTime; } collectorTimeGraph.PauseUpdates(); collectorTimeGraph.StartDateTime = fromTime; collectorTimeGraph.EndDateTime = toTime; collectorTimeGraph.MaxGraphValue = initialMax; collectorTimeGraph.Series = graphSeriesList; if (graphSeriesList == null || graphSeriesList.Count == 0) { collectorTimeGraph.GraphHeaderText = "No Series!"; Text = $"Collector Graph"; } else if (graphSeriesList.Count == 1) { collectorTimeGraph.GraphHeaderText = graphSeriesList[0].Name; Text = $"Collector Graph - {graphSeriesList[0].Name}"; } else { collectorTimeGraph.GraphHeaderText = $"Collectors graph"; Text = $"Collector Graph"; } collectorTimeGraph.SetAutoMinMaxDateTimes(chkAutoFromTime.Checked, chkAutoToTime.Checked, chkAutoMaxValue.Checked); //collectorTimeGraph.BackgroundGradientColor1 = Properties.Settings.Default.GraphBackgroundColor1; //collectorTimeGraph.BackgroundGradientColor2 = Properties.Settings.Default.GraphBackgroundColor2; //collectorTimeGraph.GridColor = Properties.Settings.Default.GraphGridColor; //collectorTimeGraph.AxisLabelColor = Properties.Settings.Default.GraphAxisLabelsColor; //collectorTimeGraph.TimeSelectionColor = Properties.Settings.Default.GraphSelectionBarColor; ////collectorTimeGraph.GraphVerticalAxisType = (GraphVerticalAxisType)Properties.Settings.Default.GraphDefaultType; //collectorTimeGraph.GradientDirection = (System.Drawing.Drawing2D.LinearGradientMode)Properties.Settings.Default.GraphGradientDirection; //collectorTimeGraph.ClosestClickedValueColorType = (ClosestClickedValueColorType)Properties.Settings.Default.GraphClosestClickedValueType; //collectorTimeGraph.ClosestClickedValueCustomColor = Properties.Settings.Default.GraphClosestClickedValueColor; //collectorTimeGraph.ShowGraphHeader = Properties.Settings.Default.GraphHeaderVisible; //collectorTimeGraph.ShowLegendText = Properties.Settings.Default.GraphLegendVisible; //collectorTimeGraph.ShowHorisontalGridlines = Properties.Settings.Default.GraphHorisontalGridLinesVisible; //collectorTimeGraph.ShowVerticalGridLines = Properties.Settings.Default.GraphVerticalGridLinesVisible; //collectorTimeGraph.ShowSelectionBar = Properties.Settings.Default.GraphSelectionBarVisible; //collectorTimeGraph.HighlightClickedSeries = Properties.Settings.Default.GraphHighlightClickedSeriesVisible; //collectorTimeGraph.FillAreaBelowGraph = Properties.Settings.Default.GraphEnableFillAreaBelowSeries; //collectorTimeGraph.FillAreaBelowGraphAlpha = Properties.Settings.Default.GraphFillAreaBelowSeriesAlpha; this.Invoke((MethodInvoker) delegate { collectorTimeGraph.RefreshGraph(); }); }
private void LoadValuesChart(IEnumerable <ForecastedFleetSizeEntity> setA, IEnumerable <ForecastedFleetSizeEntity> setB) { var seriesList = new List <GraphSeries>(); var series = new List <string> { "Expected", "Unconstrained", "Nessesary" , "Max A", "Min A", "Expected With Adds A", "Max B", "Min B", "Expected With Adds B" }; ShowSeries.AddRange(series.ToArray()); var expectedSeries = new GraphSeries(series[0]) { GraphColour = Color.DarkGreen, Displayed = true }; var unconstrainedSeries = new GraphSeries(series[1]) { GraphColour = Color.CornflowerBlue, Displayed = true }; var nessesarySeries = new GraphSeries(series[2]) { GraphColour = Color.Brown, Displayed = true }; var maxSeriesA = new GraphSeries(series[3]) { GraphColour = Color.Magenta, Displayed = false }; GraphInformation.HiddenSeriesNames.Add(series[3]); var minSeriesA = new GraphSeries(series[4]) { GraphColour = Color.Magenta, Displayed = false }; GraphInformation.HiddenSeriesNames.Add(series[4]); var expectedWithAddsA = new GraphSeries(series[5]) { GraphColour = Color.DarkOrchid, Displayed = true }; var maxSeriesB = new GraphSeries(series[6]) { GraphColour = Color.Orange, Displayed = false }; GraphInformation.HiddenSeriesNames.Add(series[6]); var minSeriesB = new GraphSeries(series[7]) { GraphColour = Color.Orange, Displayed = false }; GraphInformation.HiddenSeriesNames.Add(series[7]); var expectedWithAddsB = new GraphSeries(series[8]) { GraphColour = Color.OrangeRed, Displayed = true }; foreach (var f in setA) { expectedSeries.Xvalue.Add(f.Week); unconstrainedSeries.Xvalue.Add(f.Week); nessesarySeries.Xvalue.Add(f.Week); maxSeriesA.Xvalue.Add(f.Week); minSeriesA.Xvalue.Add(f.Week); expectedSeries.Yvalue.Add((double)f.ExpectedFleet); unconstrainedSeries.Yvalue.Add(f.UnConstrained); nessesarySeries.Yvalue.Add(f.Nessesary); maxSeriesA.Yvalue.Add(f.MaxFleet); minSeriesA.Yvalue.Add(f.MinFleet); expectedWithAddsA.Xvalue.Add(f.Week); expectedWithAddsA.Yvalue.Add((double)f.ExpectedWithAdditionPlan); } foreach (var f in setB) { maxSeriesB.Xvalue.Add(f.Week); minSeriesB.Xvalue.Add(f.Week); maxSeriesB.Yvalue.Add(f.MaxFleet); minSeriesB.Yvalue.Add(f.MinFleet); expectedWithAddsB.Xvalue.Add(f.Week); expectedWithAddsB.Yvalue.Add((double)f.ExpectedWithAdditionPlan); } seriesList.Add(expectedSeries); seriesList.Add(unconstrainedSeries); seriesList.Add(nessesarySeries); seriesList.Add(maxSeriesA); seriesList.Add(minSeriesA); seriesList.Add(maxSeriesB); seriesList.Add(minSeriesB); seriesList.Add(expectedWithAddsA); seriesList.Add(expectedWithAddsB); GraphInformation.SeriesData = seriesList; }
protected override void printData(string [] statValues) { //values are recorded for calculating later AVG and SD recordStatValues(statValues); if (sessions.Count == 1) { int i = 0; bool foundAVG = false; //we need to save this transposed foreach (string myValue in statValues) { if (i == 0) { //don't plot AVG and SD rows if (myValue == Catalog.GetString("AVG")) { foundAVG = true; } else { CurrentGraphData.XAxisNames.Add(myValue); } } else if (i == 1) { if (foundAVG) { serieIndex.Avg = Convert.ToDouble(myValue); } else { serieIndex.SerieData.Add(myValue); } } else if (i == 2) { if (foundAVG) { serieJump1.Avg = Convert.ToDouble(myValue); } else { serieJump1.SerieData.Add(myValue); } } else if (i == 3) { if (foundAVG) { serieJump2.Avg = Convert.ToDouble(myValue); } else { serieJump2.SerieData.Add(myValue); } } if (foundAVG && i == dataColumns) { //add created series to GraphSeries ArrayList //check don't do it two times if (GraphSeries.Count == 0) { GraphSeries.Add(serieJump1); GraphSeries.Add(serieJump2); GraphSeries.Add(serieIndex); } return; } i++; } } else { GraphSerie mySerie = new GraphSerie(); mySerie.IsLeftAxis = true; int i = 0; foreach (string myValue in statValues) { if (myValue == Catalog.GetString("AVG") || myValue == Catalog.GetString("SD")) { return; } if (i == 0) { mySerie.Title = myValue; } else { mySerie.SerieData.Add(myValue); } i++; } GraphSeries.Add(mySerie); } }
protected override void printData(string [] statValues) { if (sessions.Count == 1) { int i = 0; //we need to save this transposed string myValueBefore = ""; foreach (string myValue in statValues) { if (i == 0) { //don't plot AVG and SD rows if (myValue == Catalog.GetString("AVG") || myValue == Catalog.GetString("SD")) { return; } //global is nicer and cleaner without the AVG and SD if (GraphSeries.Count == 0) { GraphSeries.Add(serieTv); GraphSeries.Add(serieIndex); } /* * //don't plot AVG and SD rows * if( myValue == Catalog.GetString("AVG") || myValue == Catalog.GetString("SD") ) { * //good moment for adding created series to GraphSeries ArrayList * //check don't do it two times * if(GraphSeries.Count == 0) { * GraphSeries.Add(serieIndex); * GraphSeries.Add(serieTv); * } * return; * } */ if (myValue.StartsWith("IndexQ")) { CurrentGraphData.XAxisNames.Add(myValue.Replace("IndexQ", "IndexQ *10")); } else if (myValue == "FV") { CurrentGraphData.XAxisNames.Add(myValue.Replace("FV", "FV *10")); } else { CurrentGraphData.XAxisNames.Add(myValue); } //record the statistic (stripping of sex) string [] stringFullResults = myValue.Split(new char[] { '.' }); myValueBefore = stringFullResults[0]; } else { if (myValueBefore.StartsWith("DjIndex") || myValueBefore.StartsWith("RjIndex") || myValueBefore.StartsWith(Constants.RJPotencyBoscoName) || myValueBefore == "IE" || myValueBefore == Constants.ArmsUseIndexName) { serieIndex.SerieData.Add(myValue); //serieTv.SerieData.Add("-"); } else if (myValueBefore.StartsWith("IndexQ") || myValueBefore == "FV") { serieIndex.SerieData.Add(( Convert.ToDouble(myValue) * 10).ToString()); //serieTv.SerieData.Add("-"); } else { serieTv.SerieData.Add(myValue); //serieIndex.SerieData.Add("-"); } } i++; } } else { GraphSerie mySerie = new GraphSerie(); int i = 0; string myValueBefore = ""; foreach (string myValue in statValues) { if (myValue == Catalog.GetString("AVG") || myValue == Catalog.GetString("SD")) { return; } if (i == 0) { //strip of sex string [] stringFullResults = myValue.Split(new char[] { '.' }); string valueNoSex = stringFullResults[0]; if (valueNoSex.StartsWith("DjIndex") || valueNoSex.StartsWith("IndexQ") || valueNoSex.StartsWith("RjIndex") || valueNoSex.StartsWith(Constants.RJPotencyBoscoName) || valueNoSex == "IE" || valueNoSex == Constants.ArmsUseIndexName || valueNoSex == "FV") { mySerie.IsLeftAxis = false; } else { mySerie.IsLeftAxis = true; } myValueBefore = valueNoSex; //for changing later indexQ for indexQ*10 mySerie.Title = myValue; } else { if (myValueBefore.StartsWith("IndexQ")) { if (myValue == "-") { mySerie.SerieData.Add(myValue); } else { mySerie.SerieData.Add(( Convert.ToDouble(myValue) * 10).ToString()); } mySerie.Title = myValueBefore.Replace("IndexQ", "IndexQ *10"); } else if (myValueBefore == "FV") { if (myValue == "-") { mySerie.SerieData.Add(myValue); } else { mySerie.SerieData.Add(( Convert.ToDouble(myValue) * 10).ToString()); } mySerie.Title = myValueBefore.Replace("FV", "FV *10"); } else { mySerie.SerieData.Add(myValue); } } i++; } GraphSeries.Add(mySerie); } }
protected override void printData(string [] statValues) { //values are recorded for calculating later AVG and SD recordStatValues(statValues); if (sessions.Count == 1) { int i = 0; bool foundAVG = false; //we need to save this transposed foreach (string myValue in statValues) { if (i == 0) { if (myValue == Catalog.GetString("AVG")) { foundAVG = true; } else { CurrentGraphData.XAxisNames.Add(myValue); } } else if (i == 1) { if (foundAVG) { serieResultPercent.Avg = Convert.ToDouble(myValue); } else { serieResultPercent.SerieData.Add(myValue); } //2 is result and is not plotted } else if (i == 3) { if (foundAVG) { serieJump1.Avg = Convert.ToDouble(myValue); } else { serieJump1.SerieData.Add(myValue); } } else if (i == 4) { if (foundAVG) { serieJump2.Avg = Convert.ToDouble(myValue); } else { serieJump2.SerieData.Add(myValue); } } if (foundAVG && i == dataColumns) { //add created series to GraphSeries ArrayList //check don't do it two times if (GraphSeries.Count == 0) { GraphSeries.Add(serieJump1); GraphSeries.Add(serieJump2); GraphSeries.Add(serieResultPercent); } return; } i++; } } else { GraphSerie mySerie = new GraphSerie(); mySerie.IsLeftAxis = true; int i = 0; foreach (string myValue in statValues) { if (myValue == Catalog.GetString("SD")) { return; } if (i == 0) { mySerie.Title = myValue; } else if (i == sessions.Count + 1) //eg, for 2 sessions: [(0)person name, (1)sess1, (2)sess2, (3)AVG] { if (myValue != "-") { mySerie.Avg = Convert.ToDouble(myValue); } } else { mySerie.SerieData.Add(myValue); } i++; } GraphSeries.Add(mySerie); } }