mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-29 19:13:59 +00:00
chartjs zoom support + calculate macro
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
<script lang="ts" context="module">
|
||||
import Chart from 'chart.js/auto';
|
||||
import 'chartjs-adapter-moment';
|
||||
import zoomPlugin from 'chartjs-plugin-zoom';
|
||||
|
||||
const getCurrentEditor = () => getActiveComponent('ChartCore');
|
||||
|
||||
@@ -15,6 +16,8 @@
|
||||
onClick: () => getCurrentEditor().exportChart(),
|
||||
testEnabled: () => getCurrentEditor() != null,
|
||||
});
|
||||
|
||||
Chart.register(zoomPlugin);
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
|
||||
@@ -55,6 +55,26 @@
|
||||
text: chartTitle,
|
||||
};
|
||||
}
|
||||
res['zoom'] = {
|
||||
zoom: {
|
||||
wheel: {
|
||||
enabled: true,
|
||||
},
|
||||
pinch: {
|
||||
enabled: true,
|
||||
},
|
||||
drag: {
|
||||
enabled: true,
|
||||
modifierKey: 'shift',
|
||||
},
|
||||
mode: 'x',
|
||||
},
|
||||
pan: {
|
||||
enabled: true,
|
||||
mode: 'x',
|
||||
},
|
||||
};
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
@@ -76,7 +76,8 @@ return value ? value.toString().replace(new RegExp(rtext, rflags), args.replace
|
||||
default: '3',
|
||||
},
|
||||
],
|
||||
description: 'Returns string of a specified length in which the beginning of the current string is padded with spaces or other character',
|
||||
description:
|
||||
'Returns string of a specified length in which the beginning of the current string is padded with spaces or other character',
|
||||
type: 'transformValue',
|
||||
code: `return modules.lodash.padStart(value, +args.length, args.character)`,
|
||||
},
|
||||
@@ -98,7 +99,8 @@ return value ? value.toString().replace(new RegExp(rtext, rflags), args.replace
|
||||
default: '3',
|
||||
},
|
||||
],
|
||||
description: 'Returns string of a specified length in which the end of the current string is padded with spaces or other character',
|
||||
description:
|
||||
'Returns string of a specified length in which the end of the current string is padded with spaces or other character',
|
||||
type: 'transformValue',
|
||||
code: `return modules.lodash.padEnd(value, +args.length, args.character)`,
|
||||
},
|
||||
@@ -275,6 +277,22 @@ return {
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
title: 'Calculation',
|
||||
name: 'calculation',
|
||||
group: 'Tools',
|
||||
description: 'Custom expression. Use row.column_name for accessing column values, value for original value',
|
||||
type: 'transformValue',
|
||||
args: [
|
||||
{
|
||||
type: 'text',
|
||||
label: 'Expression',
|
||||
name: 'expression',
|
||||
default: 'value',
|
||||
},
|
||||
],
|
||||
code: `return eval(args.expression);`,
|
||||
},
|
||||
{
|
||||
title: 'Extract date fields',
|
||||
name: 'extractDateFields',
|
||||
|
||||
Reference in New Issue
Block a user