Skip to content
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

Added annotation support #43

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
146 changes: 74 additions & 72 deletions src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,76 +8,78 @@ import 'utils';
import { SimplePanel } from './SimplePanel';
import { PanelOptionCode } from './PanelOptionCode';

export const plugin = new PanelPlugin<SimpleOptions>(SimplePanel).setPanelOptions((builder) => {
return builder
.addCustomEditor({
id: 'data',
path: 'data',
name: 'Data',
description: 'Data of the chart',
editor: PanelOptionCode,
category: ['Plotly'],
settings: {
language: 'json',
initValue: defaults.data,
},
defaultValue: null, //defaults.data,
})
.addCustomEditor({
id: 'layout',
path: 'layout',
name: 'Layout',
description: 'Layout of the chart',
editor: PanelOptionCode,
category: ['Plotly'],
settings: {
language: 'json',
initValue: defaults.layout,
},
defaultValue: null, //defaults.layout,
})
.addCustomEditor({
id: 'config',
path: 'config',
name: 'Configuration',
description: 'Configuration of the chart',
editor: PanelOptionCode,
category: ['Plotly'],
settings: {
language: 'json',
initValue: defaults.config,
},
defaultValue: null, //defaults.config,
})
.addCustomEditor({
id: 'script',
path: 'script',
name: 'Script',
description: `
Script executed whenever new data is available.
export const plugin = new PanelPlugin<SimpleOptions>(SimplePanel)
.setDataSupport({ annotations: true })
.setPanelOptions((builder) => {
return builder
.addCustomEditor({
id: 'data',
path: 'data',
name: 'Data',
description: 'Data of the chart',
editor: PanelOptionCode,
category: ['Plotly'],
settings: {
language: 'json',
initValue: defaults.data,
},
defaultValue: null, //defaults.data,
})
.addCustomEditor({
id: 'layout',
path: 'layout',
name: 'Layout',
description: 'Layout of the chart',
editor: PanelOptionCode,
category: ['Plotly'],
settings: {
language: 'json',
initValue: defaults.layout,
},
defaultValue: null, //defaults.layout,
})
.addCustomEditor({
id: 'config',
path: 'config',
name: 'Configuration',
description: 'Configuration of the chart',
editor: PanelOptionCode,
category: ['Plotly'],
settings: {
language: 'json',
initValue: defaults.config,
},
defaultValue: null, //defaults.config,
})
.addCustomEditor({
id: 'script',
path: 'script',
name: 'Script',
description: `
Script executed whenever new data is available.

Must return an object with one or more of the following properties : data, layout, config
f(data, variables){...your code...}
`,
editor: PanelOptionCode,
category: ['Script'],
settings: {
language: 'javascript',
},
defaultValue: defaults.script,
})
.addCustomEditor({
id: 'onclick',
path: 'onclick',
name: 'Click script',
description: `
Script executed when chart is clicked.
f(data){...your code...}`,
editor: PanelOptionCode,
category: ['Click script'],
settings: {
language: 'javascript',
},
defaultValue: defaults.onclick,
});
});
Must return an object with one or more of the following properties : data, layout, config
f(data, variables){...your code...}
`,
editor: PanelOptionCode,
category: ['Script'],
settings: {
language: 'javascript',
},
defaultValue: defaults.script,
})
.addCustomEditor({
id: 'onclick',
path: 'onclick',
name: 'Click script',
description: `
Script executed when chart is clicked.
f(data){...your code...}`,
editor: PanelOptionCode,
category: ['Click script'],
settings: {
language: 'javascript',
},
defaultValue: defaults.onclick,
});
});