我想更改R中高级图的核心代码(要求来自this post)。我想更改R中highcharts的核心代码,因为我知道如何在javascript中修改它:
(function(H) {
(...)
H.seriesTypes.column.prototype.translate3dShapes = function() {
(...)
point.shapeType = 'cuboid';
shapeArgs.z = z;
shapeArgs.depth = point.options.depth; // changed from: shapeArgs.depth = depth;
shapeArgs.insidePlotArea = true;
(...)
};
})(Highcharts);
使用js_typeof
或这些解决方案调用此代码不再有用。
问题是*如何在R
中更改高级图的核心代码答案 0 :(得分:0)
您可以使用以下方法创建自定义高保真小部件:
highcharter::highchartzero()
的最小窗口小部件。此自定义小部件仅加载highcharts.js。highcharter::hc_add_dependency("highcharts-3d.js")
htmltools::htmlDependency
函数将js作为依赖项添加到窗口小部件(内部hc_add_dependency
使用此函数)代码将类似于(未经测试):
hc <- highcharter::highchartzero() %>%
highcharter::hc_add_dependency("highcharts-3d.js")
hc # see the source code and see only highcharts and highcharts-3d is loaded.
# adding depedency
dep <- htmlDependency(
name = "change-depth",
version = "1.0.0",
src = "the/folder/", # absolute path I think!
script = "your_js_script.js"
)
hc$dependencies <- c(hc$dependencies, list(dep))
hc # see the source again
hc %>% hc_add_series(...) # add the data