Skip to content

Commit

Permalink
Use RESOLUTION also for pie charts in tooltips
Browse files Browse the repository at this point in the history
  • Loading branch information
Yogu committed Feb 11, 2016
1 parent 670c236 commit 994f103
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
6 changes: 4 additions & 2 deletions src/BoundIcicle.js
Expand Up @@ -3,6 +3,7 @@ import Icicle from './CanvasIcicle';
import * as ColorGenerator from './ColorGenerator';
import $ from 'jquery';
import renderPieChart from './PieChartRenderer.js';
import { RESOLUTION } from './config';

/**
* An icicle plot visualization that is bound bidirectionally to the model
Expand Down Expand Up @@ -69,8 +70,9 @@ export default class BoundIcicle extends Icicle {

result.tooltipFn = () => {
let pieRadius = 12;
let canvas = $('<canvas>').attr('width', pieRadius * 2).attr('height', pieRadius * 2);
renderPieChart(canvas[0].getContext('2d'), pieRadius, pieRadius, pieRadius, result);
let canvas = $('<canvas>').attr('width', pieRadius * 2 * RESOLUTION).attr('height', pieRadius * 2 * RESOLUTION)
.css({width: pieRadius * 2 + 'px', height: pieRadius * 2 + 'px'});
renderPieChart(canvas[0].getContext('2d'), pieRadius * RESOLUTION, pieRadius * RESOLUTION, pieRadius * RESOLUTION, result);
return $('<span>').addClass('extended-tooltip').append(
$('<span>').addClass('node-name').text(node.label),
$('<br>'),
Expand Down
5 changes: 1 addition & 4 deletions src/CanvasIcicle.js
Expand Up @@ -4,10 +4,7 @@ import $ from 'jquery';
import * as TextUtils from './TextUtils';
import * as Sets from './Sets';
import renderPieChart from './PieChartRenderer.js';

// Set this to greater values to render icicles with higher resolutions so that zooming in
// will not pixelate the images as quick
const RESOLUTION = 2;
import { RESOLUTION } from './config';

/**
* An implementation of the icicle plot visualization with the Canvas API
Expand Down
3 changes: 3 additions & 0 deletions src/config.js
@@ -0,0 +1,3 @@
// Set this to greater values to render icicles with higher resolutions so that zooming in
// will not pixelate the images as quick
export const RESOLUTION = 2;

0 comments on commit 994f103

Please sign in to comment.