Skip to content
Browse files

Fixed problem with label placement algorithm in pie charts. Closes #304.

  • Loading branch information...
1 parent 6eeb8cc commit d0e00f6066325cda5319ab6c3f167217389ffb1a highslide-software committed Aug 4, 2011
Showing with 13 additions and 11 deletions.
  1. +8 −7 js/highcharts.src.js
  2. +5 −4 js/parts/PieSeries.js
View
15 js/highcharts.src.js
@@ -2,7 +2,7 @@
// @compilation_level SIMPLE_OPTIMIZATIONS
/**
- * @license @product.name@ JS v@product.version@ (@product.date@)
+ * @license Highcharts JS v2.1.6 (2011-07-08)
*
* (c) 2009-2011 Torstein Hønsi
*
@@ -10678,7 +10678,7 @@ var PieSeries = extendClass(Series, {
// set the anchor point for tooltips
radiusX = mathCos(angle) * positions[2] / 2;
- series.radiusY = radiusY = mathSin(angle) * positions[2] / 2;
+ radiusY = mathSin(angle) * positions[2] / 2;
point.tooltipPos = [
positions[0] + radiusX * 0.7,
positions[1] + radiusY * 0.7
@@ -10815,13 +10815,14 @@ var PieSeries = extendClass(Series, {
connector,
connectorPath,
distanceOption = options.distance,
- radiusY = series.radiusY,
+ seriesCenter = series.center,
+ radius = seriesCenter[2] / 2,
+ centerY = seriesCenter[1],
outside = distanceOption > 0,
dataLabel,
labelPos,
labelHeight,
lastY,
- centerY = series.center[1],
halves = [// divide the points into right and left halves for anti collision
[], // right
[] // left
@@ -10879,7 +10880,7 @@ var PieSeries = extendClass(Series, {
sign = lowerHalf ? 1 : -1;
// build the slots
- for (pos = centerY + radiusY - distanceOption; pos <= centerY - radiusY + distanceOption; pos += labelHeight) {
+ for (pos = centerY - radius - distanceOption; pos <= centerY + radius + distanceOption; pos += labelHeight) {
slots.push(pos);
// visualize the slot
/*
@@ -11068,7 +11069,7 @@ win.Highcharts = {
merge: merge,
pick: pick,
extendClass: extendClass,
- product: '@product.name@',
- version: '@product.version@'
+ product: 'Highcharts',
+ version: '2.1.6'
};
}());
View
9 js/parts/PieSeries.js
@@ -238,7 +238,7 @@ var PieSeries = extendClass(Series, {
// set the anchor point for tooltips
radiusX = mathCos(angle) * positions[2] / 2;
- series.radiusY = radiusY = mathSin(angle) * positions[2] / 2;
+ radiusY = mathSin(angle) * positions[2] / 2;
point.tooltipPos = [
positions[0] + radiusX * 0.7,
positions[1] + radiusY * 0.7
@@ -375,13 +375,14 @@ var PieSeries = extendClass(Series, {
connector,
connectorPath,
distanceOption = options.distance,
- radiusY = series.radiusY,
+ seriesCenter = series.center,
+ radius = seriesCenter[2] / 2,
+ centerY = seriesCenter[1],
outside = distanceOption > 0,
dataLabel,
labelPos,
labelHeight,
lastY,
- centerY = series.center[1],
halves = [// divide the points into right and left halves for anti collision
[], // right
[] // left
@@ -439,7 +440,7 @@ var PieSeries = extendClass(Series, {
sign = lowerHalf ? 1 : -1;
// build the slots
- for (pos = centerY + radiusY - distanceOption; pos <= centerY - radiusY + distanceOption; pos += labelHeight) {
+ for (pos = centerY - radius - distanceOption; pos <= centerY + radius + distanceOption; pos += labelHeight) {
slots.push(pos);
// visualize the slot
/*

0 comments on commit d0e00f6

Please sign in to comment.
Something went wrong with that request. Please try again.