@@ -20,16 +20,17 @@ var formatColor = require('../../lib/gl_format_color');
20
20
var subTypes = require ( '../scatter/subtypes' ) ;
21
21
var makeBubbleSizeFn = require ( '../scatter/make_bubble_size_func' ) ;
22
22
var getTraceColor = require ( '../scatter/get_trace_color' ) ;
23
- var MARKER_SYMBOLS = require ( '../../constants/gl2d_markers' ) ;
24
23
var MARKER_SVG_SYMBOLS = require ( '../../components/drawing/symbol_defs' ) ;
25
24
var DASHES = require ( '../../constants/gl2d_dashes' ) ;
26
25
var fit = require ( 'canvas-fit' )
26
+ var createScatter = require ( '../../../../regl-scatter2d' )
27
+ var createLine = require ( '../../../../regl-line2d' )
28
+ var Drawing = require ( '../../components/drawing' ) ;
27
29
28
30
var AXES = [ 'xaxis' , 'yaxis' ] ;
29
31
var DESELECTDIM = 0.2 ;
30
32
var TRANSPARENT = [ 0 , 0 , 0 , 0 ] ;
31
33
32
- var createScatter = require ( '../../../../regl-scatter2d' )
33
34
34
35
35
36
@@ -121,14 +122,29 @@ function createScatterScene(container) {
121
122
borderSize : 1 ,
122
123
borderColor : [ 0 , 0 , 0 , 1 ] ,
123
124
snapPoints : true ,
124
- canvas : container . canvas
125
+ canvas : container . canvas ,
126
+ pixelRatio : container . _context . plotGlPixelRatio || window . devicePixelRatio
125
127
} ;
126
128
127
129
this . scatter = createScatter ( scatterOptions0 ) ;
128
130
this . scatter . options = scatterOptions0
129
131
this . scatter . _trace = this
130
132
131
133
134
+ this . line = createLine ( {
135
+ positions : new Float64Array ( 0 ) ,
136
+ color : [ 0 , 0 , 0 , 1 ] ,
137
+ width : 1 ,
138
+ fill : [ false , false , false , false ] ,
139
+ fillColor : [
140
+ [ 0 , 0 , 0 , 1 ] ,
141
+ [ 0 , 0 , 0 , 1 ] ,
142
+ [ 0 , 0 , 0 , 1 ] ,
143
+ [ 0 , 0 , 0 , 1 ] ] ,
144
+ dashes : [ 1 ] ,
145
+ } , 0 ) ;
146
+
147
+
132
148
return this
133
149
}
134
150
@@ -252,7 +268,7 @@ proto.updateFancy = function(options) {
252
268
positions = positions . slice ( 0 , ptr ) ;
253
269
this . idToIndex = idToIndex ;
254
270
255
- // this.updateLines(options, positions);
271
+ this . updateLines ( options , positions ) ;
256
272
// this.updateError('X', options, positions, errorsX);
257
273
// this.updateError('Y', options, positions, errorsY);
258
274
@@ -278,11 +294,13 @@ proto.updateFancy = function(options) {
278
294
this . scatter . options . borderColors = new Array ( pId ) ;
279
295
280
296
var markerSizeFunc = makeBubbleSizeFn ( options ) ;
297
+
281
298
var markerOpts = options . marker ;
282
299
var markerOpacity = markerOpts . opacity ;
283
300
var traceOpacity = options . opacity ;
284
301
285
- var symbols = markerOpts . symbol //convertSymbol(markerOpts.symbol, len);
302
+ var symbols = convertSymbol ( markerOpts . symbol , len ) ;
303
+
286
304
var colors = convertColorScale ( markerOpts , markerOpacity , traceOpacity , len ) ;
287
305
var borderSizes = convertNumber ( markerOpts . line . width , len ) ;
288
306
var borderColors = convertColorScale ( markerOpts . line , markerOpacity , traceOpacity , len ) ;
@@ -296,6 +314,7 @@ proto.updateFancy = function(options) {
296
314
symbol = symbols [ index ] ;
297
315
symbolName = symbol . split ( / - o p e n | - d o t / ) [ 0 ]
298
316
symbolSpec = MARKER_SVG_SYMBOLS [ symbolName ] || { } ;
317
+
299
318
isOpen = isSymbolOpen ( symbol ) ;
300
319
isDimmed = selIds && ! selIds [ index ] ;
301
320
@@ -318,8 +337,15 @@ proto.updateFancy = function(options) {
318
337
// minBorderWidth = (symbolSpec.noBorder || symbolSpec.noFill) ? 0.1 * size : 0;
319
338
minBorderWidth = 0
320
339
321
- this . scatter . options . sizes [ i ] = 3.0 * size ;
322
- this . scatter . options . markers [ i ] = symbolSpec . f && symbolSpec . f ( 40 ) || null ;
340
+ this . scatter . options . sizes [ i ] = 2.0 * size ;
341
+
342
+ //FIXME: add better handler here
343
+ if ( symbolName === 'circle' ) {
344
+ this . scatter . options . markers [ i ] = null ;
345
+ }
346
+ else {
347
+ this . scatter . options . markers [ i ] = symbolSpec . f && symbolSpec . f ( 40 ) || null ;
348
+ }
323
349
this . scatter . options . borderSizes [ i ] = 0.5 * ( ( bw > minBorderWidth ) ? bw - minBorderWidth : 0 ) ;
324
350
325
351
var optColors = this . scatter . options . colors
@@ -359,6 +385,7 @@ proto.updateFancy = function(options) {
359
385
360
386
var bounds = [ xaxis . _rl [ 0 ] , yaxis . _rl [ 0 ] , xaxis . _rl [ 1 ] , yaxis . _rl [ 1 ] ] ;
361
387
this . scatter . options . range = bounds ;
388
+ this . scatter . options . viewport = viewBox
362
389
363
390
// prevent scatter from resnapping points
364
391
this . scatter ( this . scatter . options ) ;
@@ -523,7 +550,7 @@ function _convertArray(convert, data, count) {
523
550
var convertNumber = convertArray . bind ( null , function ( x ) { return + x ; } ) ;
524
551
var convertColorBase = convertArray . bind ( null , str2RGBArray ) ;
525
552
var convertSymbol = convertArray . bind ( null , function ( x ) {
526
- return MARKER_SYMBOLS [ x ] ? x : 'circle' ;
553
+ return MARKER_SVG_SYMBOLS [ x ] ? x : 'circle' ;
527
554
} ) ;
528
555
529
556
function convertColor ( color , opacity , count ) {
0 commit comments