diff --git a/frontend/app/visualizations/chart/index.js b/frontend/app/visualizations/chart/index.js index ac17a41d..402302ff 100644 --- a/frontend/app/visualizations/chart/index.js +++ b/frontend/app/visualizations/chart/index.js @@ -65,7 +65,6 @@ function ChartEditor(clientConfig) { scatter: { name: 'Scatter', icon: 'circle-o' }, }; - console.log(clientConfig); if (clientConfig.allowCustomJSVisualizations) { scope.chartTypes.custom = { name: 'Custom', icon: 'code' }; } diff --git a/frontend/app/visualizations/chart/plotly.js b/frontend/app/visualizations/chart/plotly.js index 785e404e..18e352ed 100644 --- a/frontend/app/visualizations/chart/plotly.js +++ b/frontend/app/visualizations/chart/plotly.js @@ -426,7 +426,7 @@ const PlotlyChart = () => { }; }; -const CustomPlotlyChart = () => { +const CustomPlotlyChart = (clientConfig) => { const customChart = { restrict: 'E', template: '
', @@ -436,6 +436,9 @@ const CustomPlotlyChart = () => { height: '=', }, link(scope, element) { + if (!clientConfig.allowCustomJSVisualizations) { + return; + } const refresh = () => { const codeCall = eval(`codeCall = function(x, ys, element, Plotly){ ${scope.options.customCode} }`); codeCall(scope.x, scope.ys, element[0].children[0], Plotly); @@ -472,5 +475,5 @@ const CustomPlotlyChart = () => { export default function (ngModule) { ngModule.constant('ColorPalette', ColorPalette); ngModule.directive('plotlyChart', PlotlyChart); - ngModule.directive('customPlotlyChart', CustomPlotlyChart); + ngModule.directive('customPlotlyChart', ['clientConfig', CustomPlotlyChart]); }