Skip to content

Commit 5c64ce0

Browse files
adding support for plotly config
1 parent 55845da commit 5c64ce0

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/plotly_renderers.coffee

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ callWithJQuery ($, Plotly) ->
1414
defaults =
1515
localeStrings: {vs: "vs", by: "by"}
1616
plotly: {}
17+
plotlyConfig: {}
1718

1819
opts = $.extend(true, {}, defaults, opts)
1920

@@ -68,13 +69,14 @@ callWithJQuery ($, Plotly) ->
6869
}
6970

7071
result = $("<div>").appendTo $("body")
71-
Plotly.newPlot(result[0], data, $.extend(layout, layoutOptions, opts.plotly))
72+
Plotly.newPlot(result[0], data, $.extend(layout, layoutOptions, opts.plotly), opts.plotlyConfig)
7273
return result.detach()
7374

7475
makePlotlyScatterChart = -> (pivotData, opts) ->
7576
defaults =
7677
localeStrings: {vs: "vs", by: "by"}
7778
plotly: {}
79+
plotlyConfig: {}
7880

7981
opts = $.extend(true, {}, defaults, opts)
8082

@@ -96,15 +98,15 @@ callWithJQuery ($, Plotly) ->
9698
layout = {
9799
title: pivotData.rowAttrs.join("-") + ' vs ' + pivotData.colAttrs.join("-")
98100
hovermode: 'closest',
99-
xaxis: {title: pivotData.colAttrs.join('-'), domain: [0.1, 1.0]},
100-
yaxis: {title: pivotData.rowAttrs.join('-')},
101+
xaxis: {title: pivotData.colAttrs.join('-'), automargin: true},
102+
yaxis: {title: pivotData.rowAttrs.join('-'), automargin: true},
101103
width: window.innerWidth / 1.5,
102104
height: window.innerHeight / 1.4 - 50
103105
}
104106

105107
renderArea = $("<div>", style: "display:none;").appendTo $("body")
106108
result = $("<div>").appendTo renderArea
107-
Plotly.newPlot(result[0], [data], $.extend(layout, opts.plotly))
109+
Plotly.newPlot(result[0], [data], $.extend(layout, opts.plotly), opts.plotlyConfig)
108110
result.detach()
109111
renderArea.remove()
110112
return result

0 commit comments

Comments
 (0)