Pie chart: Difference between revisions
From JSXGraph Wiki
A WASSERMANN (talk | contribs) No edit summary |
A WASSERMANN (talk | contribs) No edit summary |
||
Line 10: | Line 10: | ||
{chartStyle:'pie', | {chartStyle:'pie', | ||
colorArray:['#0F408D','#6F1B75','#CA147A','#DA2228','#E8801B','#FCF302','#8DC922','#15993C','#87CCEE','#0092CE'], | colorArray:['#0F408D','#6F1B75','#CA147A','#DA2228','#E8801B','#FCF302','#8DC922','#15993C','#87CCEE','#0092CE'], | ||
fillOpacity:0. | fillOpacity:0.8, center:[5,2], strokeColor:'black', highlightStrokeColor:'black', strokeWidth:4, | ||
labelArray:['Ruby','JavaScript', 'Shell','Python', 'PHP', 'C','Perl', 'C++', 'Java', 'Flash'], | labelArray:['Ruby','JavaScript', 'Shell','Python', 'PHP', 'C','Perl', 'C++', 'Java', 'Flash'], | ||
highlightColorArray:['#E46F6A','#F9DF82','#F7FA7B','#B0D990','#69BF8E','#BDDDE4','#92C2DF','#637CB0','#AB91BC','#EB8EBF'], | highlightColorArray:['#E46F6A','#F9DF82','#F7FA7B','#B0D990','#69BF8E','#BDDDE4','#92C2DF','#637CB0','#AB91BC','#EB8EBF'], | ||
highlightOnSector:true, | highlightOnSector:true, | ||
highlightBySize:true | highlightBySize:true, | ||
//gradient:'linear'} | //gradient:'linear' | ||
} | |||
); | ); | ||
board.unsuspendUpdate(); | board.unsuspendUpdate(); | ||
</jsxgraph> | </jsxgraph> | ||
===JavaScript code to produce this chart=== | ===JavaScript code to produce this chart=== | ||
<source lang=" | <source lang="javascript"> | ||
var dataArr = [30,16,14,10,10,8,6,6,4,4]; | |||
var board = JXG.JSXGraph.initBoard('jxgbox', {showNavigation:false, showCopyright:true, originX: 120, originY: 400, unitX: 50, unitY: 50}); | |||
board.containerObj.style.backgroundColor = 'black'; | |||
board.suspendUpdate(); | |||
var a = board.createElement('chart', dataArr, | |||
{chartStyle:'pie', | |||
colorArray:['#0F408D','#6F1B75','#CA147A','#DA2228','#E8801B','#FCF302','#8DC922','#15993C','#87CCEE','#0092CE'], | |||
fillOpacity:0.8, center:[5,2], strokeColor:'black', highlightStrokeColor:'black', strokeWidth:4, | |||
labelArray:['Ruby','JavaScript', 'Shell','Python', 'PHP', 'C','Perl', 'C++', 'Java', 'Flash'], | |||
highlightColorArray:['#E46F6A','#F9DF82','#F7FA7B','#B0D990','#69BF8E','#BDDDE4','#92C2DF','#637CB0','#AB91BC','#EB8EBF'], | |||
highlightOnSector:true, | |||
highlightBySize:true, | |||
//gradient:'linear' | |||
} | |||
); | |||
board.unsuspendUpdate(); | |||
</source> | </source> | ||
[[Category:Examples]] | [[Category:Examples]] | ||
[[Category:Charts]] | [[Category:Charts]] |
Revision as of 09:24, 3 August 2010
A pie chart with highlight on the whole sector, enlarging labels on highlight and a gradient fill.
JavaScript code to produce this chart
var dataArr = [30,16,14,10,10,8,6,6,4,4];
var board = JXG.JSXGraph.initBoard('jxgbox', {showNavigation:false, showCopyright:true, originX: 120, originY: 400, unitX: 50, unitY: 50});
board.containerObj.style.backgroundColor = 'black';
board.suspendUpdate();
var a = board.createElement('chart', dataArr,
{chartStyle:'pie',
colorArray:['#0F408D','#6F1B75','#CA147A','#DA2228','#E8801B','#FCF302','#8DC922','#15993C','#87CCEE','#0092CE'],
fillOpacity:0.8, center:[5,2], strokeColor:'black', highlightStrokeColor:'black', strokeWidth:4,
labelArray:['Ruby','JavaScript', 'Shell','Python', 'PHP', 'C','Perl', 'C++', 'Java', 'Flash'],
highlightColorArray:['#E46F6A','#F9DF82','#F7FA7B','#B0D990','#69BF8E','#BDDDE4','#92C2DF','#637CB0','#AB91BC','#EB8EBF'],
highlightOnSector:true,
highlightBySize:true,
//gradient:'linear'
}
);
board.unsuspendUpdate();