Skip to content

Commit

Permalink
Version 3.4-rc1
Browse files Browse the repository at this point in the history
Code cleanup and minor bug fixes
Updates for new DWC build script
Replaced .gitignore
  • Loading branch information
chrishamm committed Feb 13, 2022
1 parent a2bf345 commit a463947
Show file tree
Hide file tree
Showing 13 changed files with 492 additions and 447 deletions.
24 changes: 23 additions & 1 deletion .gitignore
@@ -1 +1,23 @@
plugin.zip
.DS_Store
node_modules
/.vs
/bin
/dist
/obj

# local env files
.env.local
.env.*.local

# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.sw*
*.user
5 changes: 3 additions & 2 deletions README.md
Expand Up @@ -40,6 +40,7 @@ new DwcPlugin({

If you wish to develop on the plugin, run `npm run serve` in the DWC directory and open the resulting build in your browser. You can then navigate to Settings > General > Built-in Plugins and click 'start' to run the plugin. Any changes made in `/src/plugins/ClosedLoopTuning` will then be hot-reloaded and reflected live in the browser.

Once you have finished developing, or if you just wish to compile from source, run `npm run build` in the DWC directory. This will generate the `/dist` directory within DWC. Copy all the files that start `ClosedLoopTuning....js` from `/dist/js` in **DWC** into the `dist/dwc` folder in **this** repository. Repeat and copy all the files from DWC's `/dist/css` that start `ClosedLoopTuning....css` into this repositories `/dist/dwc` directory.
## Building as an external plugin

Finally, compress the contents of this repositories `dist` folder into a zip file (such that `plugin.json` is at the top level of the zip folder). The resulting zip folder is the compiled plugin that can be uploaded to DWC as described in 'Getting Started'.
Once you have finished developing, or if you just wish to compile from source, run `npm run build-plugin ../Closed-Loop-Plugin` in the DWC directory where `../Closed-Loo-Plugin` points to this directory.
This will generate a ZIP file in the `dist` directory within DWC that can be uploaded as a plugin.
1 change: 0 additions & 1 deletion dist/.gitignore

This file was deleted.

2 changes: 0 additions & 2 deletions dist/dwc/.gitignore

This file was deleted.

5 changes: 3 additions & 2 deletions dist/plugin.json → plugin.json
Expand Up @@ -2,7 +2,8 @@
"id": "ClosedLoopTuning",
"name": "Closed Loop Tuning",
"author": "Louis Irwin",
"version": "0.3-alpha",
"version": "auto",
"dwcVersion": "auto",
"license": "MIT",
"homepage": "https://duet3d.com"
}
}
Binary file removed plugin.zip
Binary file not shown.
51 changes: 27 additions & 24 deletions src/Chart.vue
@@ -1,33 +1,42 @@
<style>
.chartjs-size-monitor {
position: relative !important;
}
</style>

<style scoped>
canvas {
position: absolute;
}
</style>

<template>
<v-card class="d-flex flex-column flex-grow-1" min-height="40rem" height="100%">
<v-card class="d-flex flex-column flex-grow-1 fill-height" min-height="40rem">
<v-card-title class="pt-2 pb-1">
<v-icon dense class="mr-2">mdi-chart-sankey</v-icon>
Data Chart
<v-spacer></v-spacer>
</v-card-title>

<v-card-text class="content flex-grow-1 px-2 py-0">

<div class="text-h4 text--disabled text-center pt-16" v-if="!data">
Select a file to view
</div>
<div class="text-h4 text--disabled text-center pt-16" v-else-if="variables.length == 0">
<div class="text-h4 text--disabled text-center pt-16" v-else-if="variables.length === 0">
Select some variables to plot<br>
</div>

<div style="height: 5%;" v-if="data && variables.length > 0">
<v-range-slider

v-model="rangeFilter"
hide-details
:max="data.Sample.length"
min="0"
></v-range-slider>
/>
</div>

<div style="height: 95%;" v-show="data && variables.length > 0">
<canvas ref="chart"></canvas>
</div>

</v-card-text>
</v-card>
</template>
Expand All @@ -36,13 +45,14 @@
'use strict'
import Chart from 'chart.js'
import { yAxes } from './config.js'
export default {
data() {
return {
chart: null,
rangeFilter: [0,0],
rangeFilter: [0,0]
}
},
props: {
Expand All @@ -69,14 +79,19 @@ export default {
yAxisID: variable.axis,
label: variable.title,
data: this.data[variable.title] ?
this.data[variable.title].map((val, idx) => ({x:this.data.Timestamp[idx], y:variable.filter ? variable.filter(val) : val})).slice(this.rangeFilter[0], this.rangeFilter[1])
this.data[variable.title]
.map((val, idx) => ({
x: this.data.Timestamp[idx],
y: variable.filter ? variable.filter(val) : val
}))
.slice(this.rangeFilter[0], this.rangeFilter[1])
: [],
borderColor: variable.colour,
fill: false,
tension: 0,
tension: 0
}));
let axesRequired = this.variables.map(x => x.axis);
const axesRequired = this.variables.map(x => x.axis);
this.chart.options.scales.yAxes = yAxes.filter(yAxis => axesRequired.includes(yAxis.id));
} else {
this.chart.data.datasets = [];
Expand Down Expand Up @@ -106,16 +121,4 @@ export default {
}
}
}
</script>

<style scoped>
canvas {
position: absolute;
}
</style>

<style>
.chartjs-size-monitor {
position: relative !important;
}
</style>
</script>
14 changes: 8 additions & 6 deletions src/ClosedLoopTuning.vue
Expand Up @@ -4,7 +4,7 @@
<v-col cols="12">
<Recorder
:recordingProgress="-1"
@recordingfinished="recordingFinished"
@recordingFinished="recordingFinished"
/>
</v-col>
</v-row>
Expand Down Expand Up @@ -67,18 +67,20 @@ export default {
inputText = inputText.split("\n");
const header = inputText[0].split(",");
let data = {};
for (var variable of header) {
for (let variable of header) {
data[variable] = [];
}
inputText.slice(1).forEach(row => {
if (row=="") {return;}
if (row === "") {
return;
}
row = row.split(",");
for (var i=0; i<row.length; i++) {
for (let i = 0; i < row.length; i++) {
data[Object.keys(data)[i]].push(parseFloat(row[i]));
}
});
return data;
},
},
async selected(file) {
if (!file) {
this.loadedData = null;
Expand All @@ -91,7 +93,7 @@ export default {
showError: false
}));
this.availableVariables = Object.keys(data).filter(x => x != "Sample");
this.availableVariables = Object.keys(data).filter(x => x !== "Sample");
this.loadedData = data;
}
},
Expand Down

0 comments on commit a463947

Please sign in to comment.