highchart编辑器库事件监听

时间:2019-07-08 12:09:30

标签: javascript highcharts highcharts-editor

我无法将事件功能绑定到highchart编辑器库。

我想在编辑器库执行其操作时执行操作。例如, 对于钩子“ ImportCSV”,“ Change”和“ ChartChange”,我想将功能附加到编辑器库中。 我正在尝试通过以下代码进行操作:

INSERT INTO INVOICE_CATEGORIZED 
SELECT TAB.INVOICE_NUMBER, TAB.INVOICE_NAME FROM
(SELECT 
TRIM(dbms_lob.SUBSTR(INVOICE_INN,6 ,1)) AS INVOICE_NUMBER, 

SUBSTR(INVOICE_INN, 
INSTR(INVOICE_INN, '(') + 1,
INSTR(INVOICE_INN, ')') - INSTR(INVOICE_INN, '(') - 1 )
 AS INVOICE_NAME

-- HERE INVOICE_INN IS STRING NOW, SO WE CAN DO STRING OPERATIONS ON IT ONWARD

FROM
(
-- DIVIDING ; SEPARATED CLOB TO INDIVIDUAL STRING
SELECT
    TRIM(CASE WHEN INVOICE_SINGLE.COLUMN_VALUE = 1 THEN
    dbms_lob.SUBSTR(INVOICE, 
    dbms_lob.INSTR(INVOICE,';',1,INVOICE_SINGLE.COLUMN_VALUE) - 1,
    1 
    )
    ELSE
    dbms_lob.SUBSTR(INVOICE, 
    dbms_lob.INSTR(INVOICE,';',1,INVOICE_SINGLE.COLUMN_VALUE) - 1
    - dbms_lob.INSTR(INVOICE,';',1,INVOICE_SINGLE.COLUMN_VALUE - 1),
    dbms_lob.INSTR(INVOICE,';',1,INVOICE_SINGLE.COLUMN_VALUE - 1) + 1)
    END) AS INVOICE_INN
FROM
    INVOICES T,
    TABLE ( CAST(MULTISET(
        SELECT
            LEVEL
        FROM
            DUAL
        CONNECT BY
            dbms_lob.INSTR(INVOICE,';',1,LEVEL) <> 0
    ) AS SYS.ODCINUMBERLIST) ) INVOICE_SINGLE)) TAB 
     WHERE NOT EXISTS (SELECT 1 FROM INVOICE_CATEGORIZED IC
    WHERE IC.INVOICE_NUMBER  = TAB.INVOICE_NUMBER
    AND IC.INVOICE_NAME = TAB.INVOICE_NAME)

也是这个

let edit = highed.Editor(document.body)

edit.on('ImportCSV', function () {
//Do something with the modified chart here.
console.log('ImportCSV')
})

但这两种方法都不适合我。 我的问题是,当某些挂钩被触发时,执行特定任务的正确方法是什么?

ref:https://github.com/highcharts/highcharts-editor/wiki/Editor-API

1 个答案:

答案 0 :(得分:1)

您可以使用以下编辑器事件:

highed.ready(function() {
  var Editor = highed.Editor(document.body, {
    defaultChartOptions: {
      title: {
        text: 'Cool Chart!'
      },
      subtitle: {
        text: 'My Cool Chart!'
      },
      data: {
        csv: "\"row\";\"val\"\n\"2013-01-01\";24\n\"2014-01-01\";76\n\"2015-01-01\";23"
      }
    },
    features: 'import export templates customize'
  });

  Editor.chart.on('ChartChange', function(data) {
    console.log('Chart changed! -> ', data);
  });
});

但是,正如您可以在文档中看到的那样,没有类似ImportCSV或Change这样的事件。