Skip to content

BarChart-Port #90

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 40 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
f8d8d32
Added StandardMagDurCurve modelcontroller and updated gsf/xda depende…
prestoncraw Mar 11, 2024
1c826e2
Added npm build script, updated packages, fix issues with webpack config
prestoncraw Mar 11, 2024
b1cf0d1
Added MagDurChart component and moved StandardMagDurCurve controller
prestoncraw Mar 12, 2024
d23f6ec
update apiPath in magdurchart
prestoncraw Mar 12, 2024
d8c3f01
Added react packages to scripts folder while porting to react
prestoncraw Mar 12, 2024
bd8225d
Added Skeleton components for NavBar and BarChart
prestoncraw Mar 12, 2024
599712c
Added meterList and selectMeterGroup to the window so it can be globa…
prestoncraw Mar 22, 2024
6ff98cb
Added ResizeObserver to dynamically resize the plot
prestoncraw Mar 27, 2024
f211059
Added loading state with loading icon
prestoncraw Mar 27, 2024
76504f9
Updated urlParams on showMagDur() so that we can render the component…
prestoncraw Mar 27, 2024
a30d415
Update openXDA.model and gemstone packages
prestoncraw Mar 27, 2024
2283a27
Added a timeout to the loading state to better reflect the rendering …
prestoncraw Mar 28, 2024
57c6a71
Remove loading state/ new queryParams in favor of passing them in as …
prestoncraw Mar 29, 2024
d376580
Added various functions and variables to the window to be used in the…
prestoncraw Apr 1, 2024
bc1988c
Fix typo in yDomain memo
prestoncraw Apr 1, 2024
3bf080f
Remove uneccessary tags
prestoncraw Jun 28, 2024
76f0233
Ported barchart to a react component
prestoncraw Jun 28, 2024
d1d24cd
Added a global interfaces file
prestoncraw Jun 28, 2024
81441ed
Cleaned up some code in magdurchart
prestoncraw Jun 28, 2024
f52e587
Normalized naming in Table Controllers
prestoncraw Jun 28, 2024
251a31a
Added logic to center time and fill missing time gaps
prestoncraw Jun 28, 2024
6f79ee8
Ported Tab Tables to react components
prestoncraw Jun 28, 2024
ebdfd89
Ported TrendingData plot to a react component
prestoncraw Jun 28, 2024
ae6d392
Added entry for whiskerline
prestoncraw Jun 28, 2024
504a245
added image for pqbrowser
prestoncraw Jun 28, 2024
d018f4e
Update default.js for new TrendingData plot component
prestoncraw Jun 28, 2024
0146b99
Disable lint checks on tsx files that will get removed later on
prestoncraw Jun 28, 2024
df86d4d
comment out skeleton of navbar
prestoncraw Jun 28, 2024
3485b71
update proj file with new tsx files
prestoncraw Jun 28, 2024
7a1632c
Fix bug on page reload
prestoncraw Jun 28, 2024
4427342
update package json
prestoncraw Jun 28, 2024
3882d5e
Added an interfaces file for Tables and fixed lint errors
prestoncraw Jul 1, 2024
655eb78
Fix remaining lint errors/warnings
prestoncraw Jul 1, 2024
402168d
Added Plots folder
prestoncraw Jul 1, 2024
9150f02
Fix condition
prestoncraw Jul 1, 2024
9fab726
Added ContextManager component & moved hover logic to bargroup
prestoncraw Jul 8, 2024
4b2feef
Moved hover logic to gemstone
prestoncraw Jul 8, 2024
f338151
cleanup
prestoncraw Jul 8, 2024
172f965
Cleanup
prestoncraw Jul 9, 2024
4d218aa
Removed snapMouse
prestoncraw Jul 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified src/Dependencies/GSF/GSF.Web.dll
Binary file not shown.
Binary file modified src/Dependencies/openXDA/openXDA.Model.dll
Binary file not shown.
2 changes: 2 additions & 0 deletions src/PQDashboard/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
"@typescript-eslint/no-namespace": "off",
"@typescript-eslint/ban-types": "error",
"no-empty-pattern": "error",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/strict-boolean-expressions": [
"error",
{
Expand Down
28 changes: 14 additions & 14 deletions src/PQDashboard/Controllers/Breakers/TableDataController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,20 +76,20 @@ DECLARE @endDate DateTime

SELECT * INTO #MeterSelection FROM dbo.String_to_int_table(@MeterID, ',')
SELECT
Meter.ID AS meterid,
Event.ID AS theeventid,
EventType.Name AS eventtype,
BreakerOperation.ID AS breakeroperationid,
CAST(CAST(BreakerOperation.TripCoilEnergized AS TIME) AS NVARCHAR(100)) AS energized,
BreakerOperation.BreakerNumber AS breakernumber,
Asset.AssetName AS linename,
Phase.Name AS phasename,
CAST(BreakerOperation.BreakerTiming AS DECIMAL(16,5)) AS timing,
CAST(BreakerOperation.StatusTiming AS DECIMAL(16,5)) AS statustiming,
BreakerOperation.BreakerSpeed AS speed,
BreakerOperation.StatusBitChatter AS chatter,
BreakerOperation.DcOffsetDetected AS dcoffset,
BreakerOperationType.Name AS operationtype,
Meter.ID AS MeterID,
Event.ID AS EventID,
EventType.Name AS EventType,
BreakerOperation.ID AS BreakerOperationID,
CAST(CAST(BreakerOperation.TripCoilEnergized AS TIME) AS NVARCHAR(100)) AS Energized,
BreakerOperation.BreakerNumber AS BreakerNumber,
Asset.AssetName AS LineName,
Phase.Name AS PhaseName,
CAST(BreakerOperation.BreakerTiming AS DECIMAL(16,5)) AS Timing,
CAST(BreakerOperation.StatusTiming AS DECIMAL(16,5)) AS StatusTiming,
BreakerOperation.BreakerSpeed AS Speed,
BreakerOperation.StatusBitChatter AS Chatter,
BreakerOperation.DcOffsetDetected AS DcOffset,
BreakerOperationType.Name AS OperationType,
(SELECT COUNT(*) FROM EventNote WHERE EventNote.EventID = Event.ID) as notecount
FROM
BreakerOperation JOIN
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ public CompletenessTableDataController()
"SELECT * INTO #MeterSelection FROM dbo.String_to_int_table(@meterList, ',') " +
"" +
"SELECT " +
" FirstSummary.ID theeventid, " +
" Meter.ID themeterid, " +
" Meter.Name thesite, " +
" FirstSummary.ID EventID, " +
" Meter.ID MeterID, " +
" Meter.Name Site, " +
" MeterDataQualitySummary.ExpectedPoints Expected, " +
" DailyTrendingSummary.ValidCount + DailyTrendingSummary.InvalidCount Received, " +
" CONVERT(FLOAT, DailyTrendingSummary.ValidCount + DailyTrendingSummary.InvalidCount) / MeterDataQualitySummary.ExpectedPoints * 100 Completeness " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ public CorrectnessTableDataController()
"SELECT * INTO #MeterSelection FROM dbo.String_to_int_table(@meterList, ',') " +
"" +
"SELECT " +
" FirstSummary.ID theeventid, " +
" Meter.ID themeterid, " +
" Meter.Name thesite, " +
" FirstSummary.ID EventID, " +
" Meter.ID MeterID, " +
" Meter.Name Site, " +
" MeterDataQualitySummary.LatchedPoints / CONVERT(FLOAT, DailyTrendingSummary.ValidCount + DailyTrendingSummary.InvalidCount) * 100 Latched, " +
" MeterDataQualitySummary.UnreasonablePoints / CONVERT(FLOAT, DailyTrendingSummary.ValidCount + DailyTrendingSummary.InvalidCount) * 100 Unreasonable, " +
" MeterDataQualitySummary.NoncongruentPoints / CONVERT(FLOAT, DailyTrendingSummary.ValidCount + DailyTrendingSummary.InvalidCount) * 100 Noncongruent, " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
using GSF.Data.Model;
using GSF.Collections;
using openXDA.Model;
using GSF.Web.Model;

namespace PQDashboard.Controllers.Disturbances
{
Expand Down Expand Up @@ -109,4 +110,11 @@ WHERE PhaseID IN (SELECT ID FROM Phase WHERE Name = 'Worst') AND
}
}
}

[SettingsCategory("dbOpenXDA")]
public class StandardMagDurCurve : openXDA.Model.StandardMagDurCurve { }

[RoutePrefix("api/Disturbances/StandardMagDurCurve")]
public class StandardMagDurCurveController : ModelController<StandardMagDurCurve>
{ }
}
46 changes: 23 additions & 23 deletions src/PQDashboard/Controllers/Faults/TableDataController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,29 +53,29 @@ FROM String_to_int_table(@MeterID, ',')

; WITH FaultDetail AS
(
SELECT
FaultSummary.ID AS thefaultid,
Meter.Name AS thesite,
Meter.ShortName AS theshortsite,
Location.ShortName AS locationname,
Meter.ID AS themeterid,
Asset.ID AS thelineid,
Event.ID AS theeventid,
Asset.AssetName AS AssetName,
AssetType.Name AS AssetType,
Asset.VoltageKV AS voltage,
CAST(CAST(Event.StartTime AS TIME) AS NVARCHAR(100)) AS theinceptiontime,
FaultSummary.FaultType AS thefaulttype,
FaultCauseMetrics.TreeFaultResistance,
FaultCauseMetrics.LightningMilliseconds,
FaultCauseMetrics.InceptionDistanceFromPeak,
FaultCauseMetrics.PrefaultThirdHarmonic,
FaultCauseMetrics.GroundCurrentRatio,
FaultCauseMetrics.LowPrefaultCurrentRatio,
CASE WHEN FaultSummary.Distance = '-1E308' THEN 'NaN' ELSE CAST(CAST(FaultSummary.Distance AS DECIMAL(16,2)) AS NVARCHAR(19)) END AS thecurrentdistance,
(SELECT COUNT(*) FROM FaultNote WHERE FaultSummary.ID = FaultNote.FaultSummaryID) as notecount,
ROW_NUMBER() OVER(PARTITION BY Event.ID ORDER BY FaultSummary.IsSuppressed, FaultSummary.IsSelectedAlgorithm DESC, FaultSummary.Inception) AS rk
FROM
SELECT
FaultSummary.ID AS FaultID,
Meter.Name AS Site,
Meter.ShortName AS ShortName,
Location.ShortName AS LocationName,
Meter.ID AS MeterID,
Asset.ID AS LineID,
Event.ID AS EventID,
Asset.AssetName AS AssetName,
AssetType.Name AS AssetType,
Asset.VoltageKV AS kV,
CAST(CAST(Event.StartTime AS TIME) AS NVARCHAR(100)) AS InceptionTime,
FaultSummary.FaultType AS FaultType,
FaultCauseMetrics.TreeFaultResistance,
FaultCauseMetrics.LightningMilliseconds,
FaultCauseMetrics.InceptionDistanceFromPeak,
FaultCauseMetrics.PrefaultThirdHarmonic,
FaultCauseMetrics.GroundCurrentRatio,
FaultCauseMetrics.LowPrefaultCurrentRatio,
CASE WHEN FaultSummary.Distance = '-1E308' THEN 'NaN' ELSE CAST(CAST(FaultSummary.Distance AS DECIMAL(16,2)) AS NVARCHAR(19)) END AS CurrentDistance,
(SELECT COUNT(*) FROM FaultNote WHERE FaultSummary.ID = FaultNote.FaultSummaryID) as notecount,
ROW_NUMBER() OVER(PARTITION BY Event.ID ORDER BY FaultSummary.IsSuppressed, FaultSummary.IsSelectedAlgorithm DESC, FaultSummary.Inception) AS RK
FROM
FaultSummary JOIN
Event ON FaultSummary.EventID = Event.ID JOIN
FaultCauseMetrics ON FaultSummary.EventID = FaultCauseMetrics.EventID AND FaultSummary.FaultNumber = FaultCauseMetrics.FaultNumber JOIN
Expand Down
67 changes: 66 additions & 1 deletion src/PQDashboard/Controllers/Generic/BarChartController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,30 @@ public IHttpActionResult Post(DataForPeriodForm form)

if (chartSettings.First(x => x.Text == column.ColumnName).Enabled == true)
{
eventSet.Types[eventSet.Types.IndexOf(x => x.Name == column.ColumnName)].Data.Add(Tuple.Create(Convert.ToDateTime(row["thedate"]), Convert.ToInt32(row[column.ColumnName])));
DateTime originalDate = Convert.ToDateTime(row["thedate"]);
DateTime centeredDate = originalDate;

if (form.context == "day")
centeredDate = originalDate.AddMinutes(30);
else if (form.context == "hour")
centeredDate = originalDate.AddSeconds(30);
else if (form.context == "minute")
centeredDate = originalDate.AddMilliseconds(500);
else
{
TimeSpan duration = eventSet.EndDate - eventSet.StartDate;
if (duration.TotalDays >= 1)
centeredDate = originalDate.AddHours(12);
}

eventSet.Types[eventSet.Types.IndexOf(x => x.Name == column.ColumnName)].Data.Add(Tuple.Create(centeredDate, Convert.ToInt32(row[column.ColumnName])));
}
}
}


// Fill missing time values based on the context
FillMissingTimeValues(eventSet, form.context);
return Ok(eventSet);

}
Expand All @@ -176,6 +194,53 @@ public IHttpActionResult Post(DataForPeriodForm form)
}
}

private void FillMissingTimeValues(EventSet eventSet, string context)
{
List<DateTime> allTimeValues;

if (context == "day")
allTimeValues = Enumerable.Range(0, (int)(eventSet.EndDate - eventSet.StartDate).TotalHours + 1)
.Select(offset => eventSet.StartDate.AddHours(offset).AddMinutes(30))
.ToList();

else if (context == "hour")
allTimeValues = Enumerable.Range(0, (int)(eventSet.EndDate - eventSet.StartDate).TotalMinutes + 1)
.Select(offset => eventSet.StartDate.AddMinutes(offset).AddSeconds(30))
.ToList();

else if (context == "minute")
allTimeValues = Enumerable.Range(0, (int)(eventSet.EndDate - eventSet.StartDate).TotalSeconds + 1)
.Select(offset => eventSet.StartDate.AddSeconds(offset).AddMilliseconds(500))
.ToList();

else if (context == "second")
allTimeValues = Enumerable.Range(0, (int)(eventSet.EndDate - eventSet.StartDate).TotalMilliseconds + 1)
.Select(offset => eventSet.StartDate.AddMilliseconds(offset).AddMilliseconds(0.5))
.ToList();
else
// Default to days as a custom context is a range of days
allTimeValues = Enumerable.Range(0, (int)(eventSet.EndDate - eventSet.StartDate).TotalDays + 1)
.Select(offset => eventSet.StartDate.AddDays(offset).AddHours(12))
.ToList();

foreach (var eventType in eventSet.Types)
{
var existingDates = eventType.Data.Select(d => d.Item1).ToList();
var missingDates = allTimeValues.Except(existingDates).ToList();

foreach (var missingDate in missingDates)
{
//Fill gaps with 0
eventType.Data.Add(Tuple.Create(missingDate, 0));
}

// Sort the data by date
eventType.Data = eventType.Data.OrderBy(d => d.Item1).ToList();
}
}



#endregion
}
}
1 change: 1 addition & 0 deletions src/PQDashboard/Controllers/PQDashboardController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
using GSF.Data;
using GSF.Data.Model;
using GSF.Web;
using GSF.Web.Model;
using openXDA.Model;
using PQDashboard.MapMetrics;

Expand Down
18 changes: 9 additions & 9 deletions src/PQDashboard/Controllers/Trending/TableDataController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,16 @@ declare @theDate as Date
INSERT INTO @MeterIDs(ID) SELECT Value FROM dbo.String_to_int_table(@MeterID, ',');

Select
Meter.ID as meterid,
Channel.ID as channelid,
Meter.Name as sitename,
'Alarm' as eventtype,
[dbo].[MeasurementCharacteristic].[Name] as characteristic,
[dbo].[MeasurementType].[Name] as measurementtype,
[dbo].[Phase].[Name] as phasename,
Meter.ID as MeterID,
Channel.ID as ChannelID,
Meter.Name as Site,
'Alarm' as EventType,
[dbo].[MeasurementCharacteristic].[Name] as Characteristic,
[dbo].[MeasurementType].[Name] as MeasurementType,
[dbo].[Phase].[Name] as PhaseName,
Channel.HarmonicGroup,
SUM (ChannelAlarmSummary.AlarmPoints) as eventcount,
@theDate as date
SUM (ChannelAlarmSummary.AlarmPoints) as EventCount,
@theDate as Date

from Channel

Expand Down
14 changes: 7 additions & 7 deletions src/PQDashboard/Controllers/TrendingData/TableDataController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,16 @@ DECLARE @context as nvarchar(20) = {2}

-- Trending Data
SELECT
Meter.ID as meterid,
Meter.Name as Name,
Channel.ID as channelid,
DailyTrendingSummary.Date as date,
Meter.ID as MeterID,
Meter.Name as Site,
Channel.ID as ChannelID,
DailyTrendingSummary.Date as Date,
MIN(Minimum/COALESCE(Channel.PerUnitValue,1)) as Minimum,
MAX(Maximum/COALESCE(Channel.PerUnitValue,1)) as Maximum,
AVG(Average/COALESCE(Channel.PerUnitValue,1)) as Average,
MeasurementCharacteristic.Name as characteristic,
MeasurementType.Name as measurementtype,
Phase.Name as phasename
MeasurementCharacteristic.Name as Characteristic,
MeasurementType.Name as MeasurementType,
Phase.Name as PhaseName
FROM
DailyTrendingSummary JOIN
Channel ON DailyTrendingSummary.ChannelID = Channel.ID JOIN
Expand Down
Binary file added src/PQDashboard/Images/PQBrowser.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 9 additions & 2 deletions src/PQDashboard/PQDashboard.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,7 @@
<Content Include="Images\2-Line - 500.png" />
<Content Include="Images\map-icon.png" />
<Content Include="Images\openSEE - Waveform Viewer Header.png" />
<Content Include="Images\PQBrowser.png" />
<Content Include="Images\PQDashboardLogo II w-GPA_600.png" />
<Content Include="Images\PQI.png" />
<Content Include="Images\SE Dashboard with GPA 200 high.png" />
Expand Down Expand Up @@ -592,8 +593,6 @@
<Content Include="Views\Login\Index.cshtml" />
<Content Include="Views\Login\Logout.cshtml" />
<Content Include="Views\Login\UserInfo.cshtml" />
<None Include="webpack.development.config.js" />
<None Include="webpack.production.config.js" />
<None Include="webpack.config.js" />
</ItemGroup>
<ItemGroup>
Expand Down Expand Up @@ -1431,8 +1430,16 @@
<Service Include="{4A0DDDB5-7A95-4FBF-97CC-616D07737A77}" />
</ItemGroup>
<ItemGroup>
<TypeScriptCompile Include="Scripts\TSX\Plots\BarChart.tsx" />
<TypeScriptCompile Include="Scripts\TSX\DetailTables\interfaces.d.ts" />
<TypeScriptCompile Include="Scripts\TSX\global.d.ts" />
<TypeScriptCompile Include="Scripts\TSX\Plots\MagDurChart.tsx" />
<TypeScriptCompile Include="Scripts\TSX\MeterEventsByLine.tsx" />
<TypeScriptCompile Include="Scripts\TSX\NavBar.tsx" />
<TypeScriptCompile Include="Scripts\TSX\Table.tsx" />
<TypeScriptCompile Include="Scripts\TSX\DetailTables\Tables.tsx" />
<TypeScriptCompile Include="Scripts\TSX\DetailTables\TableWrapper.tsx" />
<TypeScriptCompile Include="Scripts\TSX\Plots\WhiskerLineChart.tsx" />
</ItemGroup>
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
Expand Down
Loading