-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optimized performance by caching results for getBBox for numbers, sin…
…ce numbers are monospaced and the same bounding box applies to any number of the same character length and the same font family and font size. Also, don't delete cached bounding box on word wrap when there is only one word. These two optimizations improved rendering times by 15% on Chrome and Firefox using our benchmark tests. Relates to #2525.
- Loading branch information
1 parent
2447cc6
commit 1e97bff
Showing
25 changed files
with
512 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
samples/maps/coloraxis/dataclasses-labelformatter/demo.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#container { | ||
height: 500px; | ||
min-width: 310px; | ||
max-width: 800px; | ||
margin: 0 auto; | ||
} | ||
.loading { | ||
margin-top: 10em; | ||
text-align: center; | ||
color: gray; | ||
} |
File renamed without changes.
12 changes: 12 additions & 0 deletions
12
samples/maps/coloraxis/dataclasses-labelformatter/demo.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<script src="http://code.highcharts.com/highcharts.js"></script> | ||
<script src="http://code.highcharts.com/modules/data.src.js"></script> | ||
<script src="http://code.highcharts.com/modules/map.src.js"></script> | ||
<script src="http://www.highcharts.local/samples/data/maps/world.js"></script> | ||
|
||
|
||
<div id="container"> | ||
<div class="loading"> | ||
<i class="icon-spinner icon-spin icon-large"></i> | ||
Loading data from Google Spreadsheets... | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
$(function () { | ||
|
||
|
||
|
||
|
||
// Load the data from a Google Spreadsheet | ||
// https://docs.google.com/a/highsoft.com/spreadsheet/pub?hl=en_GB&hl=en_GB&key=0AoIaUO7wH1HwdFJHaFI4eUJDYlVna3k5TlpuXzZubHc&output=html | ||
Highcharts.data({ | ||
|
||
|
||
googleSpreadsheetKey: '0AoIaUO7wH1HwdFJHaFI4eUJDYlVna3k5TlpuXzZubHc', | ||
|
||
// custom handler when the spreadsheet is parsed | ||
parsed: function (columns) { | ||
|
||
// Read the columns into the data array | ||
var data = []; | ||
$.each(columns[0], function (i, code) { | ||
data.push({ | ||
code: code.toUpperCase(), | ||
value: parseFloat(columns[2][i]), | ||
name: columns[1][i] | ||
}) | ||
}); | ||
|
||
|
||
// Initiate the chart | ||
$('#container').highcharts('Map', { | ||
chart : { | ||
borderWidth : 1 | ||
}, | ||
|
||
colors: ['rgba(19,64,117,0.1)', 'rgba(19,64,117,0.5)', 'rgba(19,64,117,1)'], | ||
|
||
title : { | ||
text : 'Data classes with legend label formatter' | ||
}, | ||
|
||
mapNavigation: { | ||
enabled: true | ||
}, | ||
|
||
legend: { | ||
title: { | ||
text: 'Population density' | ||
}, | ||
align: 'left', | ||
verticalAlign: 'bottom', | ||
floating: true, | ||
labelFormatter: function () { | ||
if (this.from === undefined) { | ||
return 'Below ' + this.to; | ||
} else if (this.to === undefined) { | ||
return 'Above ' + this.from; | ||
} else { | ||
return this.from + ' to ' + this.to; | ||
} | ||
|
||
}, | ||
layout: 'vertical', | ||
valueDecimals: 0, | ||
backgroundColor: 'rgba(255,255,255,0.9)', | ||
symbolRadius: 0, | ||
symbolHeight: 14 | ||
}, | ||
|
||
colorAxis: { | ||
dataClasses: [{ | ||
to: 20 | ||
}, { | ||
from: 20, | ||
to: 200 | ||
}, { | ||
from: 200 | ||
}] | ||
}, | ||
|
||
series : [{ | ||
data : data, | ||
mapData: Highcharts.maps.world, | ||
joinBy: 'code', | ||
name: 'Population density', | ||
states: { | ||
hover: { | ||
color: '#BADA55' | ||
} | ||
}, | ||
tooltip: { | ||
valueSuffix: '/km²' | ||
}, | ||
}] | ||
}); | ||
} | ||
}); | ||
}); |
Oops, something went wrong.