Compare commits

...

1 Commits

Author SHA1 Message Date
nthu1080112244 3c4676ec2c [update] construct new table for chart axis unit 2022-07-26 09:45:49 +08:00
2 changed files with 171 additions and 0 deletions
@@ -0,0 +1,170 @@
const chartConfigTable = {
// split 'A-B' by '-',
// then A-B[0] is about 'A' and A-B[1] is about 'B'
T_V: [
// 0
{
default: {
name: 'Time',
unit: {
us: 1,
ms: 1e3,
s: 1e6,
min: 60 * 1e6,
hour: 60 * 60 * 1e6,
},
defaultUnit: 'ms',
downloadUnit: 'ms',
},
},
// 1
{
default: {
name: 'Voltage',
unit: {
uV: 1,
mV: 1e3,
V: 1e6,
},
defaultUnit: 'mV',
downloadUnit: 'mV',
},
},
],
T_I: [
// 0
{
default: {
name: 'Time',
unit: {
us: 1,
ms: 1e3,
s: 1e6,
min: 60 * 1e6,
hour: 60 * 60 * 1e6,
},
defaultUnit: 'ms',
downloadUnit: 'ms',
},
},
// 1
{
default: {
name: 'Current',
unit: {
nA: 1,
uA: 1e3,
mA: 1e6,
A: 1e9,
},
defaultUnit: 'mA',
downloadUnit: 'mA',
},
// Q = ∫ I dt
integral: {
name: 'Charge',
unit: {
nC: 1e6,
uC: 1e9,
mC: 1e12,
C: 1e15,
},
defaultUnit: 'mC',
downloadUnit: 'mC',
},
},
],
T_R: [
// 0
{
default: {
name: 'Time',
unit: {
us: 1,
ms: 1e3,
s: 1e6,
min: 60 * 1e6,
hour: 60 * 60 * 1e6,
},
defaultUnit: 'ms',
downloadUnit: 'ms',
},
},
// 1
{
default: {
name: 'Resistor',
unit: {
: 1,
Ω: 1e3,
: 1e6,
: 1e9,
},
defaultUnit: 'Ω',
downloadUnit: 'Ω',
},
},
],
V_I: [
// 0
{
default: {
name: 'Voltage',
unit: {
uV: 1,
mV: 1e3,
V: 1e6,
},
defaultUnit: 'mV',
downloadUnit: 'mV',
},
// 𝜡 = dV/dI
differential: {
name: 'Impedance',
unit: {
: 1,
Ω: 1e3,
: 1e6,
: 1e9,
},
defaultUnit: 'Ω',
downloadUnit: 'Ω',
},
},
// 1
{
default: {
name: 'Current',
unit: {
nA: 1,
uA: 1e3,
mA: 1e6,
A: 1e9,
},
defaultUnit: 'mA',
downloadUnit: 'mA',
},
// Gm = dI/dV
differential: {
name: 'Trancuductance',
unit: {
'mA/V': 1,
'A/V': 1e3,
'kA/V': 1e6,
},
defaultUnit: 'A/V',
downloadUnit: 'A/V',
},
},
],
}
export const chartConfigRouter = {
getUnit: (xAxis, yAxis, funct) => {
funct = (funct === undefined) ? 'default' : funct
const name1 = xAxis + '_' + yAxis
const name2 = yAxis + '_' + xAxis
if (chartConfigTable[name1] !== undefined) return chartConfigTable[name1]
else if (chartConfigTable[name2] !== undefined) return chartConfigTable[name2]
else return 'idiot'
},
}
+1
View File
@@ -9,3 +9,4 @@ $ionicons-font-path: "~ionicons/dist/fonts";
$fa-font-path: "~font-awesome/fonts";
@import "../../../node_modules/font-awesome/scss/font-awesome";
@import url(https://fonts.googleapis.com/icon?family=Material+Icons);