Skip to content

1002 data export wrong data types for timestamps#1064

Open
Chitransh31 wants to merge 31 commits intomasterfrom
1002-data-export-wrong-data-types-for-timestamps
Open

1002 data export wrong data types for timestamps#1064
Chitransh31 wants to merge 31 commits intomasterfrom
1002-data-export-wrong-data-types-for-timestamps

Conversation

@Chitransh31
Copy link

Fixed the sheets' names, merged the redundant sheets and created a new Auswertung sheet with chart image generation using uPlot. Scatter chart with ExcelJs did not work because of limited chart support and xlsx-chart creates an entirely new excel file for chart generation. Fixed colours in the chart and added legends below the chart for the parameters.

Copilot AI review requested due to automatic review settings January 21, 2026 23:27
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses issue #1002 regarding incorrect data types for timestamps in Excel exports. The changes consolidate redundant sheets into a unified format, add a new "Auswertung" (Analysis) sheet with embedded chart visualization using uPlot, and fix sheet naming conventions.

Changes:

  • Converted exportGraphsToExcel from synchronous to async to support chart image generation
  • Merged separate data and stats sheets into combined sheets with side-by-side layout
  • Added new "Auswertung" sheet with embedded chart images and legends generated via uPlot
  • Improved sheet naming logic based on graph title, series title, and unit type

Comment on lines 278 to 282
// Wrap to next line if needed
if (legendX > 1100 && index < allSheetData.length - 1) {
legendX = 20;
legendY += 20;
}
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The legend wrapping logic on lines 278-282 calculates when to wrap to the next line but doesn't properly check if the canvas height is sufficient for multiple rows of legend items. If there are many series, the legend could overflow the 50px canvas height, causing items to be cut off. Consider dynamically calculating the required height based on the number of items and rows needed.

Copilot uses AI. Check for mistakes.
Comment on lines 27 to 30
export async function exportGraphsToExcel(
graphDataMap: Map<string, () => GraphExportData | null>,
groupId: string,
): void {
): Promise<void> {
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function changed from synchronous to async but the handleExport callback in useGraphSync.ts (line 129) doesn't await the result. This means errors from the async function won't be properly caught by the caller. Consider updating the calling code to handle the promise returned by exportGraphsToExcel, or at least add .catch() to handle rejections.

Copilot uses AI. Check for mistakes.

// Determine column header based on sheet name and unit
// Extract base name from sheet name (e.g., "Nozzle Temp, Watt" -> "Nozzle")
let baseName = sheetName;
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The initial value of baseName is unused, since it is always overwritten.

Suggested change
let baseName = sheetName;
let baseName: string;

Copilot uses AI. Check for mistakes.
@MilanVDB
Copy link
Collaborator

@TheBest6337 pleaase review, and give me an update what you think about styl & ability

@MilanVDB MilanVDB requested a review from TheBest6337 January 22, 2026 07:11
@TheBest6337
Copy link
Member

@Chitransh31 please fix the build issues that come from code formatting

Copy link
Member

@TheBest6337 TheBest6337 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Im not a fan of this implementation. Its too much code that is A not necesarry or an duplicate of something which could have been done only once. B - too much hardcoded stuff... like the Control Version or all the if cases of string for the machines that can easily break because no one expects this stuff in an excel export.

You should use more object based programming, I think that it should be possible to remove most of the hardcoded stuff and get the data from the current graph implementation, which would be way cleaner. Some functions also seem to be pretty long and could be made into their own file, this would make an cleaner implementation and you need less duplicate code. If you need to create small changes to an machine file because of that you can do so, the namespaces are there for a reason or you can get the data from the graph page...

Copilots suggestions are also somewhat true..

Comment on lines 867 to 874
new Date().toLocaleString("de-DE", {
year: "numeric",
month: "2-digit",
day: "2-digit",
hour: "2-digit",
minute: "2-digit",
second: "2-digit",
}),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

duplicate

@Chitransh31 Chitransh31 force-pushed the 1002-data-export-wrong-data-types-for-timestamps branch from 845421f to 4408feb Compare January 25, 2026 22:11
@TheBest6337
Copy link
Member

@Chitransh31 whats your status on this, can I review it?

@Chitransh31
Copy link
Author

@Chitransh31 whats your status on this, can I review it?

Yes, you can review it.

Copy link
Member

@TheBest6337 TheBest6337 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code wise its good, i would put most of the files in an extra folder under graph (excel) for example or excelExport. So you can get an better overview.

When i opened the saved excel file for the Mock-Machine im greeted with an error message:

Image Image

please fix that

@Chitransh31 Chitransh31 force-pushed the 1002-data-export-wrong-data-types-for-timestamps branch 2 times, most recently from c3e1b88 to 8d108e3 Compare January 30, 2026 12:59
@Chitransh31
Copy link
Author

Code wise its good, i would put most of the files in an extra folder under graph (excel) for example or excelExport. So you can get an better overview.

When i opened the saved excel file for the Mock-Machine im greeted with an error message:

Image Image
please fix that

Screenshot 2026-01-30 at 2 08 40 PM Refactored to move the excel export files in graph/excelExport folder. I'm able to download and open all the graphs. Please verify.

Saurabh Bagade and others added 12 commits January 30, 2026 17:42
…ore and the relevant logs are now passed as a parameter
…into their own files for readability and maintainability. added support for pid export as stated in the issue and config export to follow dependency inversion principle and to centralize the required hardcoded values to provide type safe access
…sed the corrupt excel export file. added excel sheet sanitizer to check whether the exported excel file is clean
@Chitransh31 Chitransh31 force-pushed the 1002-data-export-wrong-data-types-for-timestamps branch from aacdcd5 to 603513f Compare January 30, 2026 16:42
@Chitransh31
Copy link
Author

@TheBest6337 please review the code.

@TheBest6337
Copy link
Member

@Chitransh31 looks good to me, I will still whait with the merge because I want to test it with a larger set of data during production.

Copy link
Member

@TheBest6337 TheBest6337 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just found a bug: When you export once it saves these values but if you then whait a few mins and want to save another set it still only saves to old one. Its possible that you might need to clear some things.

Image (This was exported at 14:09)

Seems only to happen when staying on the graphs page, if I move to another and then switch back it works as expected.

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Data Export - wrong data types for timestamps (dates) and all other values (rpm, bar, °C, W,A,etc)

3 participants