diff --git a/src/core/mark/bar.ts b/src/core/mark/bar.ts index e61212b7..366588dd 100644 --- a/src/core/mark/bar.ts +++ b/src/core/mark/bar.ts @@ -96,7 +96,6 @@ export function drawBar(track: any, tile: Tile, model: GoslingTrackModel) { (isFlippedY && y - rowHeight >= 0) || (!isFlippedY && y <= 0) ) { - console.warn('inside', model.specOriginal.id); return; } @@ -108,11 +107,14 @@ export function drawBar(track: any, tile: Tile, model: GoslingTrackModel) { ); let polygonForMouseEvents: number[] = []; + const barHeight = isFlippedY ? rowHeight - y : y; if (circular) { - const farR = trackOuterRadius - ((rowHeight - prevYEnd) / trackHeight) * trackRingSize; - const nearR = trackOuterRadius - ((rowHeight - y - prevYEnd) / trackHeight) * trackRingSize; + const ys = isFlippedY ? prevYEnd : rowHeight - prevYEnd; + const farR = trackOuterRadius - (ys / trackHeight) * trackRingSize; + const ye = isFlippedY ? barHeight + prevYEnd : rowHeight - y - prevYEnd; + const nearR = trackOuterRadius - (ye / trackHeight) * trackRingSize; const sPos = cartesianToPolar(xs, trackWidth, nearR, cx, cy, startAngle, endAngle); const startRad = valueToRadian(xs, trackWidth, startAngle, endAngle); @@ -134,7 +136,6 @@ export function drawBar(track: any, tile: Tile, model: GoslingTrackModel) { /* Mouse Events */ model.getMouseEventModel().addPolygonBasedEvent(d, polygonForMouseEvents); - prevYEnd += barHeight; }); }); diff --git a/src/tracks/gosling-track/gosling-track.ts b/src/tracks/gosling-track/gosling-track.ts index 598903c4..9f0956dc 100644 --- a/src/tracks/gosling-track/gosling-track.ts +++ b/src/tracks/gosling-track/gosling-track.ts @@ -1011,7 +1011,7 @@ const factory: PluginTrackFactory = (HGC, context, op // Replace width and height information with the actual values for responsive encoding const [trackWidth, trackHeight] = this.dimensions; // actual size of a track - const axisSize = IsXAxis(resolvedSpec) ? HIGLASS_AXIS_SIZE : 0; // Why the axis size must be added here? + const axisSize = IsXAxis(resolvedSpec) && this.options.spec.layout === 'linear' ? HIGLASS_AXIS_SIZE : 0; // Why the axis size must be added here? const [w, h] = [trackWidth, trackHeight + axisSize]; const circularFactor = Math.min(w, h) / Math.min(resolvedSpec.width!, resolvedSpec.height!); if (resolvedSpec.innerRadius) {