From edcebf302bf6d550bc6edf6de5e4798ca787e4d8 Mon Sep 17 00:00:00 2001 From: James Friel Date: Mon, 3 Jun 2024 14:41:01 +0100 Subject: [PATCH 01/10] working scallable graph --- Rdmp.UI/AggregationUIs/AggregateGraphUI.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Rdmp.UI/AggregationUIs/AggregateGraphUI.cs b/Rdmp.UI/AggregationUIs/AggregateGraphUI.cs index f6629eae84..7168f448e6 100644 --- a/Rdmp.UI/AggregationUIs/AggregateGraphUI.cs +++ b/Rdmp.UI/AggregationUIs/AggregateGraphUI.cs @@ -504,6 +504,10 @@ private void PopulateGraphResults(QueryTimeColumn countColumn, AggregateContinuo if (index > chart1.Series.Count - 1) chart1.Series.Add(new Series()); + chart1.ChartAreas[0].AxisX.ScaleView.Zoomable = true; + chart1.ChartAreas[0].CursorX.AutoScroll = true; + chart1.ChartAreas[0].CursorX.IsUserSelectionEnabled = true; + chart1.Series[index].XValueMember = _dt.Columns[0].ColumnName; chart1.Series[index].YValueMembers = _dt.Columns[index + 1].ColumnName; From b11dc90267fa17292709dadc1e1476414e5afc16 Mon Sep 17 00:00:00 2001 From: James Friel Date: Mon, 3 Jun 2024 14:43:28 +0100 Subject: [PATCH 02/10] add changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1728454df3..78e8bcf32e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Add Key-Value store for instance settings - Allow for Re-extractions of projects to a database, see [ExecuteFullExtractionToDatabaseMSSql](Documentation\DataExtractions\ExecuteFullExtractionToDatabaseMSSql.md) +- Allow DQE graphs to be scrollable and scalable ## [8.1.6] - 2024-05-27 From d16d2228953d94146d97b488d576e7070aabb31b Mon Sep 17 00:00:00 2001 From: James Friel Date: Tue, 4 Jun 2024 13:54:25 +0100 Subject: [PATCH 03/10] add axis override --- Rdmp.Core/QueryBuilding/AggregateBuilder.cs | 8 ++++++++ Rdmp.UI/AggregationUIs/AggregateGraphUI.cs | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Rdmp.Core/QueryBuilding/AggregateBuilder.cs b/Rdmp.Core/QueryBuilding/AggregateBuilder.cs index 0c2a752b18..50b78929b2 100644 --- a/Rdmp.Core/QueryBuilding/AggregateBuilder.cs +++ b/Rdmp.Core/QueryBuilding/AggregateBuilder.cs @@ -82,6 +82,10 @@ public string SQL /// public string HavingSQL { get; set; } + + public string AxisStartDateOverride { get; set; } + public string AxisEndDateOverride { get; set; } + /// /// Optional, Limit the results returned. /// @@ -435,6 +439,10 @@ public void RegenerateSQL() GetGroupBySQL(queryLines, aggregateHelper); queryLines = queryLines.Where(l => !string.IsNullOrWhiteSpace(l.Text)).ToList(); + if (AxisStartDateOverride != null) + _axis.StartDate = AxisStartDateOverride; + if (AxisEndDateOverride != null) + _axis.EndDate = AxisEndDateOverride; _sql = aggregateHelper.BuildAggregate(queryLines, _axis); } diff --git a/Rdmp.UI/AggregationUIs/AggregateGraphUI.cs b/Rdmp.UI/AggregationUIs/AggregateGraphUI.cs index 7168f448e6..c8cbfdf55e 100644 --- a/Rdmp.UI/AggregationUIs/AggregateGraphUI.cs +++ b/Rdmp.UI/AggregationUIs/AggregateGraphUI.cs @@ -254,7 +254,7 @@ private void LoadGraph() var axis = AggregateConfiguration.GetAxisIfAny(); var builder = GetQueryBuilder(AggregateConfiguration); - + //builder.AxisStartDateOverride = "'2000-01-01'"; UpdateQueryViewerScreenWithQuery(builder.SQL); var countColumn = builder.SelectColumns.FirstOrDefault(c => c.IColumn is AggregateCountColumn); From 7b36a962adfd9915968b7c875d4e21bf6f81872c Mon Sep 17 00:00:00 2001 From: James Friel Date: Tue, 4 Jun 2024 16:34:21 +0100 Subject: [PATCH 04/10] interim --- Rdmp.UI/AggregationUIs/AggregateGraphUI.cs | 91 ++++++++++++++++++---- Rdmp.UI/SimpleDialogs/SelectDialog`1.resx | 63 --------------- 2 files changed, 77 insertions(+), 77 deletions(-) delete mode 100644 Rdmp.UI/SimpleDialogs/SelectDialog`1.resx diff --git a/Rdmp.UI/AggregationUIs/AggregateGraphUI.cs b/Rdmp.UI/AggregationUIs/AggregateGraphUI.cs index c8cbfdf55e..af88d78102 100644 --- a/Rdmp.UI/AggregationUIs/AggregateGraphUI.cs +++ b/Rdmp.UI/AggregationUIs/AggregateGraphUI.cs @@ -84,17 +84,9 @@ public int Timeout private readonly ToolStripMenuItem _miClipboardCsv = new("Comma Separated Format"); private readonly ToolStripMenuItem _btnCache = new("Cache", FamFamFamIcons.picture_save.ImageToBitmap()); private readonly ToolStripButton _btnResendQuery = new("Send Query", FamFamFamIcons.arrow_refresh.ImageToBitmap()); + private readonly ToolStripButton _btnRefreshData = new("Refresh Data", FamFamFamIcons.arrow_refresh.ImageToBitmap()); private readonly ToolStripTimeout _timeoutControls = new(); - private ToolStripMenuItem miSaveImages = new("Save Image", FamFamFamIcons.disk.ImageToBitmap()); - - private ToolStripMenuItem miCopyToClipboard = new("Copy to Clipboard", CatalogueIcons.Clipboard.ImageToBitmap()); - private ToolStripMenuItem miClipboardWord = new("Word Format"); - private ToolStripMenuItem miClipboardCsv = new("Comma Separated Format"); - private ToolStripMenuItem btnCache = new("Cache", FamFamFamIcons.picture_save.ImageToBitmap()); - - private ToolStripButton btnResendQuery = new("Send Query", FamFamFamIcons.arrow_refresh.ImageToBitmap()); - public AggregateGraphUI() { InitializeComponent(); @@ -132,6 +124,7 @@ public AggregateGraphUI() _miClipboardCsv.ToolTipText = "Copies data as CSV formatted"; _btnResendQuery.Click += btnResendQuery_Click; + _btnRefreshData.Click += btnRefreshData_Click; _miSaveImages.Click += MiSaveImagesClick; _btnCache.Click += btnCache_Click; @@ -151,6 +144,7 @@ private void SetToolbarButtonsEnabled(bool enabled) _miClipboardCsv.Enabled = enabled && _dt is { Rows.Count: > 0 }; _miClipboardWord.Enabled = enabled && _dt is { Rows.Count: > 0 }; _btnResendQuery.Enabled = enabled; + _btnRefreshData.Enabled = enabled; } public AggregateConfiguration AggregateConfiguration => _aggregateConfiguration; @@ -176,6 +170,12 @@ public void AbortLoadGraph() private Task _loadTask; + public void ReloadDataBetweenDates(string startDate, string endDate) + { + _loadTask = new Task(() => LoadGraph(true, startDate, endDate)); + _loadTask.Start(); + } + public void LoadGraphAsync() { //it is already executing @@ -208,7 +208,7 @@ public void LoadGraphAsync() label1.ForeColor = Color.Black; label1.Text = GetDescription(); - _loadTask = new Task(LoadGraph); + _loadTask = new Task(() => LoadGraph()); _loadTask.Start(); } @@ -230,7 +230,30 @@ protected virtual string GetDescription() => private DataTable _dt; - private void LoadGraph() + int GetQuarterName(DateTime myDate) + { + return (int)Math.Ceiling(myDate.Month / 3.0); + } + + private DateTime ConvertAxisOverridetoDate(string axisOverride, AxisIncrement increment) + { + var overrideDate = DateTime.Parse(axisOverride); + switch (increment) + { + case AxisIncrement.Day: + return overrideDate.Date; + case AxisIncrement.Month: + return new DateTime(overrideDate.Year, overrideDate.Month, 1); + case AxisIncrement.Quarter: + return new DateTime(overrideDate.Year, (3 * GetQuarterName(overrideDate)) - 2, 1); + case AxisIncrement.Year: + return new DateTime(overrideDate.Year, 1, 1); + default: + return DateTime.Parse(axisOverride); + } + } + + private void LoadGraph(bool isRefresh = false, string startDateOverride = null, string endDateOverride = null) { try { @@ -254,6 +277,34 @@ private void LoadGraph() var axis = AggregateConfiguration.GetAxisIfAny(); var builder = GetQueryBuilder(AggregateConfiguration); + if (startDateOverride != null) + builder.AxisStartDateOverride = startDateOverride; + if (endDateOverride != null) + builder.AxisEndDateOverride = endDateOverride; + + if (isRefresh) + { + //wipe out data from dt that is between these dates + var dateColumnName = "joinDt";// axis.AggregateDimension.ColumnInfo.Name; + var columnIndex = _dt.Columns.IndexOf(dateColumnName); + + var incriment = axis.AxisIncrement; + + + var startDate = ConvertAxisOverridetoDate(startDateOverride.Trim('\''), incriment); + var endDate = ConvertAxisOverridetoDate(endDateOverride.Trim('\''), incriment); + var rowsToDelete = _dt.Rows.Cast().Where(r => + { + var templateString = "0000-01-01"; + var currentDT = DateTime.Parse(templateString.Replace(templateString[0..r.ItemArray[columnIndex].ToString().Length], r.ItemArray[columnIndex].ToString())); + return currentDT >= startDate && currentDT <= endDate; + }).ToList(); + foreach (var row in rowsToDelete) + { + _dt.Rows.Remove(row); + } + Console.WriteLine(dateColumnName); + } //builder.AxisStartDateOverride = "'2000-01-01'"; UpdateQueryViewerScreenWithQuery(builder.SQL); @@ -272,7 +323,10 @@ private void LoadGraph() _cmd = server.GetCommand(builder.SQL, con); _cmd.CommandTimeout = Timeout; - _dt = new DataTable(); + if (!isRefresh) + { + _dt = new DataTable(); + } Invoke(new MethodInvoker(() => { lblLoadStage.Text = "Executing Query..."; })); @@ -281,8 +335,9 @@ private void LoadGraph() _cmd = null; //trim all leading/trailing whitespace from column - foreach (DataColumn c in _dt.Columns) - c.ColumnName = c.ColumnName.Trim(); + if (!isRefresh) + foreach (DataColumn c in _dt.Columns) + c.ColumnName = c.ColumnName.Trim(); if (_dt.Rows.Count == 0) throw new Exception("Query Returned No Rows"); @@ -737,6 +792,8 @@ protected void BuildMenu(IActivateItems activator) foreach (var c in _timeoutControls.GetControls()) CommonFunctionality.Add(c); + + CommonFunctionality.Add(_btnRefreshData); } } @@ -841,6 +898,12 @@ private void btnResendQuery_Click(object sender, EventArgs e) LoadGraphAsync(); } + + private void btnRefreshData_Click(object sender, EventArgs e) + { + ReloadDataBetweenDates("'2000-01-01'", "'2010-01-01'"); + } + public override string GetTabName() => $"Graph:{base.GetTabName()}"; private void btnCache_Click(object sender, EventArgs e) diff --git a/Rdmp.UI/SimpleDialogs/SelectDialog`1.resx b/Rdmp.UI/SimpleDialogs/SelectDialog`1.resx deleted file mode 100644 index 6252b1ef07..0000000000 --- a/Rdmp.UI/SimpleDialogs/SelectDialog`1.resx +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - True - - \ No newline at end of file From 9ea59192d956375c7c4c4f0fd5fe44dd87afbac3 Mon Sep 17 00:00:00 2001 From: James Friel Date: Tue, 4 Jun 2024 16:50:06 +0100 Subject: [PATCH 05/10] working increments --- Rdmp.UI/AggregationUIs/AggregateGraphUI.cs | 24 ++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/Rdmp.UI/AggregationUIs/AggregateGraphUI.cs b/Rdmp.UI/AggregationUIs/AggregateGraphUI.cs index af88d78102..1778ff5dc6 100644 --- a/Rdmp.UI/AggregationUIs/AggregateGraphUI.cs +++ b/Rdmp.UI/AggregationUIs/AggregateGraphUI.cs @@ -11,6 +11,7 @@ using System.Data.Common; using System.Drawing; using System.Drawing.Imaging; +using System.Globalization; using System.IO; using System.Linq; using System.Threading; @@ -295,8 +296,27 @@ private void LoadGraph(bool isRefresh = false, string startDateOverride = null, var endDate = ConvertAxisOverridetoDate(endDateOverride.Trim('\''), incriment); var rowsToDelete = _dt.Rows.Cast().Where(r => { - var templateString = "0000-01-01"; - var currentDT = DateTime.Parse(templateString.Replace(templateString[0..r.ItemArray[columnIndex].ToString().Length], r.ItemArray[columnIndex].ToString())); + var currentDT = new DateTime(); + if (incriment == AxisIncrement.Day) + { + DateTime.TryParseExact(r.ItemArray[columnIndex].ToString(), "yyyy-mm-dd", CultureInfo.InvariantCulture, DateTimeStyles.None, out currentDT); + } + if (incriment == AxisIncrement.Month) + { + DateTime.TryParseExact(r.ItemArray[columnIndex].ToString(), "yyyy-mm", CultureInfo.InvariantCulture, DateTimeStyles.None, out currentDT); + } + if (incriment == AxisIncrement.Quarter) + { + var year = r.ItemArray[columnIndex].ToString()[0..4]; + var asString = r.ItemArray[columnIndex].ToString(); + var quarter = Int32.Parse(asString.Substring(asString.Length - 1)) * 3; + DateTime.TryParseExact($"{year}-{quarter}", "yyyy-mm", CultureInfo.InvariantCulture, DateTimeStyles.None, out currentDT); + + } + if (incriment == AxisIncrement.Year) + { + DateTime.TryParseExact(r.ItemArray[columnIndex].ToString(), "yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, out currentDT); + } return currentDT >= startDate && currentDT <= endDate; }).ToList(); foreach (var row in rowsToDelete) From f88e5d1a6f6cde85c15b1e50bddde7c9f4cc38df Mon Sep 17 00:00:00 2001 From: James Friel Date: Wed, 5 Jun 2024 08:34:02 +0100 Subject: [PATCH 06/10] working ui refresh --- .../AggregateGraphDateSelector.Designer.cs | 128 ++++++++++++++++++ .../Advanced/AggregateGraphDateSelector.cs | 108 +++++++++++++++ .../Advanced/AggregateGraphDateSelector.resx | 120 ++++++++++++++++ Rdmp.UI/AggregationUIs/AggregateGraphUI.cs | 14 +- 4 files changed, 367 insertions(+), 3 deletions(-) create mode 100644 Rdmp.UI/AggregationUIs/Advanced/AggregateGraphDateSelector.Designer.cs create mode 100644 Rdmp.UI/AggregationUIs/Advanced/AggregateGraphDateSelector.cs create mode 100644 Rdmp.UI/AggregationUIs/Advanced/AggregateGraphDateSelector.resx diff --git a/Rdmp.UI/AggregationUIs/Advanced/AggregateGraphDateSelector.Designer.cs b/Rdmp.UI/AggregationUIs/Advanced/AggregateGraphDateSelector.Designer.cs new file mode 100644 index 0000000000..c2d76cb7ca --- /dev/null +++ b/Rdmp.UI/AggregationUIs/Advanced/AggregateGraphDateSelector.Designer.cs @@ -0,0 +1,128 @@ +namespace Rdmp.UI.AggregationUIs.Advanced +{ + partial class AggregateGraphDateSelector + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + btnRefresh = new System.Windows.Forms.Button(); + btnCancel = new System.Windows.Forms.Button(); + tbStartDate = new System.Windows.Forms.TextBox(); + tbEndDate = new System.Windows.Forms.TextBox(); + label1 = new System.Windows.Forms.Label(); + label2 = new System.Windows.Forms.Label(); + SuspendLayout(); + // + // btnRefresh + // + btnRefresh.Location = new System.Drawing.Point(63, 110); + btnRefresh.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + btnRefresh.Name = "btnRefresh"; + btnRefresh.Size = new System.Drawing.Size(88, 27); + btnRefresh.TabIndex = 3; + btnRefresh.Text = "Refresh Data"; + btnRefresh.UseVisualStyleBackColor = true; + btnRefresh.Click += btnRefresh_Click; + // + // btnCancel + // + btnCancel.Location = new System.Drawing.Point(187, 110); + btnCancel.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + btnCancel.Name = "btnCancel"; + btnCancel.Size = new System.Drawing.Size(88, 27); + btnCancel.TabIndex = 4; + btnCancel.Text = "Cancel"; + btnCancel.UseVisualStyleBackColor = true; + btnCancel.Click += btnCancel_Click; + // + // tbStartDate + // + tbStartDate.Location = new System.Drawing.Point(28, 57); + tbStartDate.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + tbStartDate.Name = "tbStartDate"; + tbStartDate.Size = new System.Drawing.Size(123, 23); + tbStartDate.TabIndex = 5; + tbStartDate.TextChanged += tbStartDate_TextChanged; + // + // tbEndDate + // + tbEndDate.Location = new System.Drawing.Point(186, 57); + tbEndDate.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + tbEndDate.Name = "tbEndDate"; + tbEndDate.Size = new System.Drawing.Size(123, 23); + tbEndDate.TabIndex = 6; + tbEndDate.TextChanged += tbEndDate_TextChanged; + // + // label1 + // + label1.AutoSize = true; + label1.Location = new System.Drawing.Point(58, 28); + label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + label1.Name = "label1"; + label1.Size = new System.Drawing.Size(58, 15); + label1.TabIndex = 7; + label1.Text = "Start Date"; + label1.Click += label1_Click; + // + // label2 + // + label2.AutoSize = true; + label2.Location = new System.Drawing.Point(221, 28); + label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + label2.Name = "label2"; + label2.Size = new System.Drawing.Size(54, 15); + label2.TabIndex = 8; + label2.Text = "End Date"; + label2.Click += label2_Click; + // + // AggregateGraphDateSelector + // + AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + ClientSize = new System.Drawing.Size(360, 174); + Controls.Add(label2); + Controls.Add(label1); + Controls.Add(tbEndDate); + Controls.Add(tbStartDate); + Controls.Add(btnCancel); + Controls.Add(btnRefresh); + Name = "AggregateGraphDateSelector"; + Text = "Select a start and end date to refresh"; + Load += AggregateGraphDateSelector_Load; + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private System.Windows.Forms.Button btnRefresh; + private System.Windows.Forms.Button btnCancel; + private System.Windows.Forms.TextBox tbStartDate; + private System.Windows.Forms.TextBox tbEndDate; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + } +} \ No newline at end of file diff --git a/Rdmp.UI/AggregationUIs/Advanced/AggregateGraphDateSelector.cs b/Rdmp.UI/AggregationUIs/Advanced/AggregateGraphDateSelector.cs new file mode 100644 index 0000000000..573ba3bc3a --- /dev/null +++ b/Rdmp.UI/AggregationUIs/Advanced/AggregateGraphDateSelector.cs @@ -0,0 +1,108 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Rdmp.UI.AggregationUIs.Advanced +{ + public partial class AggregateGraphDateSelector : Form + { + public AggregateGraphDateSelector(string startDate = "", string endDate = "") + { + + StartDate = startDate; + EndDate = endDate; + InitializeComponent(); + tbStartDate.Text = startDate; + tbEndDate.Text = endDate; + validateUpdate(); + } + + public string StartDate; + public string EndDate; + + private bool validateDate(string date) + { + return DateRegex().Match(date.Trim()).Success; + } + + + private void validateUpdate() + { + var startDateValid = validateDate(tbStartDate.Text); + var endDateValid = validateDate(tbEndDate.Text); + if (!startDateValid) + { + tbStartDate.ForeColor = Color.Red; + } + else + { + tbStartDate.ForeColor = Color.Black; + } + if (!endDateValid) + { + tbEndDate.ForeColor = Color.Red; + } + else + { + tbEndDate.ForeColor = Color.Black; + } + if (!startDateValid || !endDateValid) + { + btnRefresh.Enabled = false; + } + else + { + btnRefresh.Enabled = true; + } + + } + + private void AggregateGraphDateSelector_Load(object sender, EventArgs e) + { + + } + + private void label1_Click(object sender, EventArgs e) + { + + } + + private void label2_Click(object sender, EventArgs e) + { + + } + + private void tbStartDate_TextChanged(object sender, EventArgs e) + { + StartDate = tbStartDate.Text; + validateUpdate(); + + } + + [GeneratedRegex("^'\\d{4}-(0?[1-9]|1[012])-(0?[1-9]|[12][0-9]|3[01])'$")] + private static partial Regex DateRegex(); + + private void tbEndDate_TextChanged(object sender, EventArgs e) + { + EndDate = tbEndDate.Text; + validateUpdate(); + } + + private void btnRefresh_Click(object sender, EventArgs e) + { + DialogResult = DialogResult.OK; + } + + private void btnCancel_Click(object sender, EventArgs e) + { + DialogResult = DialogResult.Cancel; + } + } +} diff --git a/Rdmp.UI/AggregationUIs/Advanced/AggregateGraphDateSelector.resx b/Rdmp.UI/AggregationUIs/Advanced/AggregateGraphDateSelector.resx new file mode 100644 index 0000000000..af32865ec1 --- /dev/null +++ b/Rdmp.UI/AggregationUIs/Advanced/AggregateGraphDateSelector.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Rdmp.UI/AggregationUIs/AggregateGraphUI.cs b/Rdmp.UI/AggregationUIs/AggregateGraphUI.cs index 1778ff5dc6..de564f1097 100644 --- a/Rdmp.UI/AggregationUIs/AggregateGraphUI.cs +++ b/Rdmp.UI/AggregationUIs/AggregateGraphUI.cs @@ -32,6 +32,7 @@ using Rdmp.Core.ReusableLibraryCode.Checks; using Rdmp.Core.ReusableLibraryCode.DataAccess; using Rdmp.Core.ReusableLibraryCode.Extensions; +using Rdmp.UI.AggregationUIs.Advanced; using Rdmp.UI.ItemActivation; using Rdmp.UI.ScintillaHelper; using Rdmp.UI.SimpleDialogs; @@ -296,6 +297,7 @@ private void LoadGraph(bool isRefresh = false, string startDateOverride = null, var endDate = ConvertAxisOverridetoDate(endDateOverride.Trim('\''), incriment); var rowsToDelete = _dt.Rows.Cast().Where(r => { + //this could maybe be more efficient with some sort of lookup atfer the first time? var currentDT = new DateTime(); if (incriment == AxisIncrement.Day) { @@ -325,7 +327,6 @@ private void LoadGraph(bool isRefresh = false, string startDateOverride = null, } Console.WriteLine(dateColumnName); } - //builder.AxisStartDateOverride = "'2000-01-01'"; UpdateQueryViewerScreenWithQuery(builder.SQL); var countColumn = builder.SelectColumns.FirstOrDefault(c => c.IColumn is AggregateCountColumn); @@ -813,7 +814,8 @@ protected void BuildMenu(IActivateItems activator) foreach (var c in _timeoutControls.GetControls()) CommonFunctionality.Add(c); - CommonFunctionality.Add(_btnRefreshData); + if (DatabaseObject.GetType() == typeof(AggregateConfiguration) && ((AggregateConfiguration)DatabaseObject).GetAxisIfAny() != null) + CommonFunctionality.Add(_btnRefreshData); } } @@ -921,7 +923,13 @@ private void btnResendQuery_Click(object sender, EventArgs e) private void btnRefreshData_Click(object sender, EventArgs e) { - ReloadDataBetweenDates("'2000-01-01'", "'2010-01-01'"); + var axis = AggregateConfiguration.GetAxisIfAny(); + var dialog = new AggregateGraphDateSelector(axis.StartDate, axis.EndDate); + if (dialog.ShowDialog() == DialogResult.OK) + { + ReloadDataBetweenDates(dialog.StartDate, dialog.EndDate); + } + //ReloadDataBetweenDates("'2000-01-01'", "'2010-01-01'"); } public override string GetTabName() => $"Graph:{base.GetTabName()}"; From de46f5b5810793676151eb9e87dd99ccd313f57e Mon Sep 17 00:00:00 2001 From: James Friel Date: Wed, 5 Jun 2024 08:35:14 +0100 Subject: [PATCH 07/10] update changelog --- CHANGELOG.md | 1 + .../Advanced/AggregateGraphDateSelector.Designer.cs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 78e8bcf32e..f18874f924 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Add Key-Value store for instance settings - Allow for Re-extractions of projects to a database, see [ExecuteFullExtractionToDatabaseMSSql](Documentation\DataExtractions\ExecuteFullExtractionToDatabaseMSSql.md) - Allow DQE graphs to be scrollable and scalable +- Allow for partial refreshes of time-based DQE charts ## [8.1.6] - 2024-05-27 diff --git a/Rdmp.UI/AggregationUIs/Advanced/AggregateGraphDateSelector.Designer.cs b/Rdmp.UI/AggregationUIs/Advanced/AggregateGraphDateSelector.Designer.cs index c2d76cb7ca..c480646f87 100644 --- a/Rdmp.UI/AggregationUIs/Advanced/AggregateGraphDateSelector.Designer.cs +++ b/Rdmp.UI/AggregationUIs/Advanced/AggregateGraphDateSelector.Designer.cs @@ -43,7 +43,7 @@ private void InitializeComponent() btnRefresh.Name = "btnRefresh"; btnRefresh.Size = new System.Drawing.Size(88, 27); btnRefresh.TabIndex = 3; - btnRefresh.Text = "Refresh Data"; + btnRefresh.Text = "Partial Refresh"; btnRefresh.UseVisualStyleBackColor = true; btnRefresh.Click += btnRefresh_Click; // From 77852a2c8179e1aaceea9125ac32fdf33902dbc1 Mon Sep 17 00:00:00 2001 From: James Friel Date: Wed, 5 Jun 2024 08:36:26 +0100 Subject: [PATCH 08/10] tidy up code --- Rdmp.UI/AggregationUIs/AggregateGraphUI.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/Rdmp.UI/AggregationUIs/AggregateGraphUI.cs b/Rdmp.UI/AggregationUIs/AggregateGraphUI.cs index de564f1097..499776e12a 100644 --- a/Rdmp.UI/AggregationUIs/AggregateGraphUI.cs +++ b/Rdmp.UI/AggregationUIs/AggregateGraphUI.cs @@ -929,7 +929,6 @@ private void btnRefreshData_Click(object sender, EventArgs e) { ReloadDataBetweenDates(dialog.StartDate, dialog.EndDate); } - //ReloadDataBetweenDates("'2000-01-01'", "'2010-01-01'"); } public override string GetTabName() => $"Graph:{base.GetTabName()}"; From b5284186755d42a6f8b2233758cfdee948180169 Mon Sep 17 00:00:00 2001 From: James Friel Date: Wed, 5 Jun 2024 08:40:10 +0100 Subject: [PATCH 09/10] add missing file --- Rdmp.UI/SimpleDialogs/SelectDialog`1.resx | 63 +++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 Rdmp.UI/SimpleDialogs/SelectDialog`1.resx diff --git a/Rdmp.UI/SimpleDialogs/SelectDialog`1.resx b/Rdmp.UI/SimpleDialogs/SelectDialog`1.resx new file mode 100644 index 0000000000..6252b1ef07 --- /dev/null +++ b/Rdmp.UI/SimpleDialogs/SelectDialog`1.resx @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + True + + \ No newline at end of file From f657a6265402a56b2a284fbfccaaacc93b4588e2 Mon Sep 17 00:00:00 2001 From: James Friel Date: Wed, 5 Jun 2024 11:12:25 +0100 Subject: [PATCH 10/10] tidy up --- Rdmp.UI/AggregationUIs/AggregateGraphUI.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Rdmp.UI/AggregationUIs/AggregateGraphUI.cs b/Rdmp.UI/AggregationUIs/AggregateGraphUI.cs index 499776e12a..46fb85f0ba 100644 --- a/Rdmp.UI/AggregationUIs/AggregateGraphUI.cs +++ b/Rdmp.UI/AggregationUIs/AggregateGraphUI.cs @@ -287,7 +287,7 @@ private void LoadGraph(bool isRefresh = false, string startDateOverride = null, if (isRefresh) { //wipe out data from dt that is between these dates - var dateColumnName = "joinDt";// axis.AggregateDimension.ColumnInfo.Name; + var dateColumnName = "joinDt"; var columnIndex = _dt.Columns.IndexOf(dateColumnName); var incriment = axis.AxisIncrement; @@ -325,7 +325,6 @@ private void LoadGraph(bool isRefresh = false, string startDateOverride = null, { _dt.Rows.Remove(row); } - Console.WriteLine(dateColumnName); } UpdateQueryViewerScreenWithQuery(builder.SQL);