-
-
Notifications
You must be signed in to change notification settings - Fork 155
Added PSD curves export and import to compare several spectrums at the chart #845
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
Merged
Merged
Changes from 5 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
6db3827
Added graph_imported_curves module for import curves
demvlad ddf5d63
Spectrum export/import code refactoring
demvlad 79b5c83
Added export/import PSD curves data
demvlad 1647d06
Added drawing of imported PSD curves
demvlad 6b580c6
Resolved code issues
demvlad c96f430
Resolved code issues
demvlad 48444a1
Code style improvement
demvlad 10364a2
Resolved issue wrong frequency definition in exported file
demvlad 622177f
Code improvement
demvlad 340a7b6
The legend is moved to right-up corner
demvlad cc01fee
The exported spectrums .csv file name is log name with _sp, _psd postfix
demvlad d26c67e
Resolved issue of imported curves frequency scaling
demvlad c3c1df2
Code refactoring: PLOTTED_BLACKBOX_RATE is replace to MAXIMAL_PLOTTED…
demvlad 5f255ac
Analyser legend position is added in user settings
demvlad 62aa2ac
Added check of valid userSetting in _drawLegend method
demvlad 4e81572
Added warning for specrum type what have not spectrum import
demvlad 0cc128c
Added newline on EOF in src/graph_imported_curves.js
demvlad 2caf5de
Changed mouse cursor info for single and multiple PSD curves
demvlad 8812bae
Code style improvement
demvlad d25b398
The mouse position cursor improvement for PSD curves
demvlad a98744b
Code style improvement
demvlad 82125da
Code style improvement
demvlad 2595258
Code style improvement
demvlad bc30951
Resolved const issue
demvlad File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| export function ImportedCurves(curvesChanged) { | ||
| const maxImportCount = 5; | ||
| this._curvesData = []; | ||
| let _that = this; | ||
| this.minX = Number.MAX_VALUE; | ||
| this.maxX = -Number.MAX_VALUE; | ||
| this.minY = Number.MAX_VALUE; | ||
| this.maxY = -Number.MAX_VALUE; | ||
|
|
||
| this.curvesCount = function() { | ||
| return this._curvesData.length; | ||
| }; | ||
|
|
||
| this.importCurvesFromCSV = function(files) { | ||
| let importsLeft = maxImportCount - this._curvesData.length; | ||
demvlad marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| for (const file of files) { | ||
| if (importsLeft-- == 0) { | ||
| break; | ||
| } | ||
| const reader = new FileReader(); | ||
| reader.onload = function (e) { | ||
| try { | ||
| const stringRows = e.target.result.split("\n"); | ||
|
|
||
| const header = stringRows[0].split(","); | ||
| if (header.length != 2 || header[0] != "x" || header[1] != "y") { | ||
| throw new SyntaxError("Wrong curves CSV data format"); | ||
| } | ||
|
|
||
| stringRows.shift(); | ||
| //remove bad last row | ||
| if (stringRows.at(-1) == "") { | ||
| stringRows.pop(); | ||
| } | ||
|
|
||
| const curvesData = stringRows.map( function(row) { | ||
| const data = row.split(","), | ||
| x = parseFloat(data[0]), | ||
| y = parseFloat(data[1]); | ||
| _that.minX = Math.min(x, _that.minX); | ||
| _that.maxX = Math.max(x, _that.maxX); | ||
| _that.minY = Math.min(y, _that.minY); | ||
| _that.maxY = Math.max(y, _that.maxY); | ||
| return { | ||
| x: x, | ||
| y: y, | ||
| }; | ||
| }); | ||
|
|
||
| const curve = { | ||
| name: file.name.split('.')[0], | ||
| points: curvesData, | ||
| }; | ||
| _that._curvesData.push(curve); | ||
| curvesChanged(); | ||
| } catch (e) { | ||
| alert('Curves data import error: ' + e.message); | ||
| return; | ||
| } | ||
| }; | ||
|
|
||
| reader.readAsText(file); | ||
| } | ||
| }; | ||
|
|
||
| this.removeCurves = function() { | ||
| this._curvesData.length = 0; | ||
| this.minX = Number.MAX_VALUE; | ||
| this.maxX = -Number.MAX_VALUE; | ||
| this.minY = Number.MAX_VALUE; | ||
| this.maxY = -Number.MAX_VALUE; | ||
| curvesChanged(); | ||
| }; | ||
| } | ||
demvlad marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.