Skip to content

Commit

Permalink
Provide widget to historical data provider
Browse files Browse the repository at this point in the history
  • Loading branch information
fqqb committed Apr 3, 2024
1 parent 7515612 commit ed35550
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export { Display } from "./Display";
export { Font } from "./Font";
export { FontResolver } from "./FontResolver";
export { DefaultPathResolver, PathResolver } from "./PathResolver";
export { Widget } from "./Widget";
export { NullablePoint, Point } from "./positioning";
export { HistoricalDataProvider } from "./pv/HistoricalDataProvider";
export { AlarmSeverity, PV } from "./pv/PV";
Expand Down
4 changes: 2 additions & 2 deletions src/pv/PVEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,11 @@ export class PVEngine {
return pv;
}

createHistoricalDataProvider(pvName: string) {
createHistoricalDataProvider(pvName: string, widget: Widget) {
for (const provider of this.providers) {
if (provider.canProvide(pvName)) {
if (provider.createHistoricalDataProvider) {
return provider.createHistoricalDataProvider(pvName);
return provider.createHistoricalDataProvider(pvName, widget);
} else {
break;
}
Expand Down
3 changes: 2 additions & 1 deletion src/pv/PVProvider.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Widget } from '../Widget';
import { HistoricalDataProvider } from "./HistoricalDataProvider";
import { PV } from "./PV";

Expand All @@ -10,7 +11,7 @@ export interface PVProvider {

isNavigable(): boolean;

createHistoricalDataProvider?(pvName: string): HistoricalDataProvider | void;
createHistoricalDataProvider?(pvName: string, widget: Widget): HistoricalDataProvider | void;

shutdown(): void;
}
2 changes: 1 addition & 1 deletion src/widgets/monitors/xygraph/Trace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export class Trace {

this.historicalDataProvider = undefined;
if (chronological && this.yPV) {
this.historicalDataProvider = pvEngine.createHistoricalDataProvider(this.yPV) || undefined;
this.historicalDataProvider = pvEngine.createHistoricalDataProvider(this.yPV, widget) || undefined;
}

this.traceData = new TraceBuffer(
Expand Down

0 comments on commit ed35550

Please sign in to comment.