javascript - "Extend"highcharts图表添加属性和功能,原型(prototype)

标签 javascript prototype highcharts

这里的另一个人试图了解如何“扩展”js“类”,​​功能对象。

具体来说,我正在使用 highcharts,需要添加其他属性和一些方法。

我正在创建一个这样的图表:

var theChart = $('#chartDiv').highcharts('StockChart', {
        chart: {
            plotBorderColor: '#2d2d30',
            plotBorderWidth: 1,
            backgroundColor: '#1e1e1e',
            marginTop: 2,
            animation: true,
            spacingBottom: 0,
            spacingTop: 10,
            ..........................

         });
 var chart = $('#chartDiv').highcharts();

那么我应该在哪里以及如何添加额外的属性,以便最终的“图表”对象拥有它们?我想第一或第二个问题是为什么“theChart”变量不是实际的图表?我不明白为什么我需要第二个 var 和 line var Chart = $('#chartDiv').highcharts();拥有一个实际的图表对象。可能是另一个问题..但是向主要的 highCharts 函数/类添加附加属性和方法是问题。希望这是有道理的。

最佳答案

也许使用.setOptions(): http://www.highcharts.com/docs/getting-started/how-to-set-options

您想添加哪些选项?

关于javascript - "Extend"highcharts图表添加属性和功能,原型(prototype),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21615516/

相关文章:

Javascript ajax 从 C# 获取未定义的数据

来自 onkeypress 处理程序的 JavaScript "return false"

javascript - 理解函数的原型(prototype)属性

javascript - Highchart 上的复选框拒绝选中或取消选中

javascript - 如何使用 Highcharts 导出多种尺寸的图表?

javascript - 如何使用 For 循环将选项 html 参数放在单独的父 div 中

javascript - React Leaflet : Get objects from MongoDB to Leaflet map as markers (using node. js 和 express)

javascript - 重写 toString 方法 - 公共(public)/私有(private)访问

javascript - 实例化是如何工作的?

highcharts - 如果特定日期不存在数据,则显示空白