Skip to content

Commit bb066a7

Browse files
author
Zoran Pandovski
committed
Use scale log base for large values on bubble charts
1 parent ef45664 commit bb066a7

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

ckanext/querytool/fanstatic/javascript/modules/viz-preview.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -186,15 +186,12 @@ ckan.module('querytool-viz-preview', function() {
186186
// On horizontal bar the x axis is now actually the y axis
187187
yrotate = x_text_rotate;
188188
}
189-
190189
if(this.options.chart_type === 'bscatter'){
191-
var rs = d3.scale.linear()
192-
.domain([0.01, 100000])
193-
.range([5, 50]);
190+
//workaround for bubble charts, scale log base 10 because of large values
191+
var rs = d3.scale.log().base(10).domain([1,1000]).range([0,10]);
194192
ctype = 'scatter';
195193
options.point = {
196194
r: function(d) {
197-
//workaround for bubble charts, divide by 10 because of large values
198195
var num = d.value;
199196
return rs(num)
200197
},

ckanext/querytool/helpers.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -170,14 +170,14 @@ def get_color_scheme():
170170
{'value': '#22758e, #b63b3b, #f9c414, #e3e8e6, #4c4555, '
171171
'#d53c3c, #80add3, #97cfcc, #e4b03d, #c39de0',
172172
'text': 'Orient'},
173-
{'value': '#3b5998, #8b9dc3, #dfe3ee, #f7f7f7, #ffffff, ',
174-
'#011f4b, #03396c, #005b96, #6497b1, #6497b1'
173+
{'value': '#3b5998, #8b9dc3, #dfe3ee, #f7f7f7, #ffffff, '
174+
'#011f4b, #03396c, #005b96, #6497b1, #6497b1',
175175
'text': 'Blue'},
176-
{'value': '#ffb3ba, #ffdfba, #ffffba, #baffc9, #bae1ff, ',
177-
'#ee4035, #f37736, #fdf498, #7bc043, #0392cf'
176+
{'value': '#ffb3ba, #ffdfba, #ffffba, #baffc9, #bae1ff, '
177+
'#ee4035, #f37736, #fdf498, #7bc043, #0392cf',
178178
'text': 'Rainbow'},
179-
{'value': '#2e4045, #83adb5, #c7bbc9, #5e3c58, #bfb5b2, ',
180-
'#a69eb0, #efeff2, #f2e2cd, #dadae3, #000000'
179+
{'value': '#2e4045, #83adb5, #c7bbc9, #5e3c58, #bfb5b2, '
180+
'#a69eb0, #efeff2, #f2e2cd, #dadae3, #000000',
181181
'text': 'Muted'}
182182
]
183183

0 commit comments

Comments
 (0)