Skip to content

Commit

Permalink
fix timeline on monitor chart
Browse files Browse the repository at this point in the history
  • Loading branch information
simlarsen committed Oct 16, 2024
1 parent bbced15 commit a39db4f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
2 changes: 2 additions & 0 deletions Common/UI/Components/Charts/Utils/DataPoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,13 @@ export default class DataPointUtil {
aggregateType: XAxisAggregateType,
): { [key: string]: SeriesData } {
const seriesDataMap: { [key: string]: SeriesData } = {};

for (const series of seriesPoints) {
for (const dataPoint of series.data) {
const date: Date = dataPoint.x;
const value: number = dataPoint.y;
const formattedDate: string = formatter(date);

for (const chartDataPoint of arrayOfData) {
if (chartDataPoint[xAxisLegend] === formattedDate) {
if (!seriesDataMap[series.seriesName]) {
Expand Down
14 changes: 8 additions & 6 deletions Common/UI/Components/ModelTable/TableView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -360,16 +360,18 @@ const TableViewElement: <T extends DatabaseBaseModel | AnalyticsBaseModel>(
>
{currentlySelectedView.name}
</div>
<div className="h-4 w-4 rounded-full bg-gray-500 text-white hover:bg-gray-800 ml-3 -mr-1 p-1">
<div
className="h-4 w-4 rounded-full bg-gray-500 text-white hover:bg-gray-800 ml-3 -mr-1 p-1"
onClick={() => {
setCurrentlySelectedView(null);
props.onViewChange && props.onViewChange(null);
closeDropdownMenu();
}}
>
<Icon
icon={IconProp.Close}
size={SizeProp.Regular}
thick={ThickProp.Thick}
onClick={() => {
setCurrentlySelectedView(null);
props.onViewChange && props.onViewChange(null);
closeDropdownMenu();
}}
/>
</div>
</div>
Expand Down
12 changes: 7 additions & 5 deletions Dashboard/src/Components/Monitor/MonitorCharts/MonitorChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ export class MonitorCharts {
title: MonitorCharts.getChartTitle({
checkOn: checkOn,
}),

description: MonitorCharts.getChartDescription({
checkOn: checkOn,
}),
Expand Down Expand Up @@ -265,11 +266,12 @@ export class MonitorCharts {
monitorMetricsByMinute: Array<MonitorMetricsByMinute>;
checkOn: CheckOn;
}): XAxis {
let startTime: Date | undefined =
data.monitorMetricsByMinute[0]?.createdAt || undefined;
let endTime: Date | undefined =
data.monitorMetricsByMinute[data.monitorMetricsByMinute.length - 1]
?.createdAt || undefined;
let startTime: Date | undefined = OneUptimeDate.addRemoveHours(
OneUptimeDate.getCurrentDate(),
-1,
);

let endTime: Date | undefined = OneUptimeDate.getCurrentDate();

let xAxisAggregationType: XAxisAggregateType = XAxisAggregateType.Average;

Expand Down

0 comments on commit a39db4f

Please sign in to comment.