ОБНОВЛЕНО:
У меня есть лучшая система для организации меток, которая просто перечисляет метки на соответствующей стороне, а затем добавляет строки из каждой метки в соответствующий сегмент.
Вы можете увидеть пример здесь:
https://www.rgraph.net/demos/pie-basic.html
И код для создания этой диаграммы:
<script src="RGraph.common.core.js"></script>
<script src="RGraph.pie.js"></script>
<canvas id="cvs" width="350" height="250">
[No canvas support]
</canvas>
<script>
// A basic configuration for a Pie chart with just the labels
// separated out into their own array. This is because the same
// array is used for both the labels and the tooltips so
// doing this makes for less upkeep when the time comes to
// change things around.
//
// Also note that the stroke color has been set to transparent so
// that there's no separation between the segments
//
labels = [ 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'];
new RGraph.Pie({
id: 'cvs',
data: [20,1,1,1,1,1,1],
options: {
// This is the tooltip property using formatted tooltips
tooltips: '%{property:myDaynames[%{index}]}<br /><span style="font-weight: bold; font-size:26pt">%{value_formatted}</span>',
// The units that are appended to the %{value_formatted} value
tooltipsFormattedUnitsPost: '%',
// Some CSS values that are set on the tooltips so that you can customise them
tooltipsCss: {
backgroundColor: 'white',
border: '3px solid black'
},
// A custom property - the formatted tooltips can then
// access this to use the data inside the tooltip
myDaynames: labels,
shadow: false,
colorsStroke: 'transparent',
keyPositionGraphBoxed: false,
}
// Draw the chart
}).draw();
</script>
person
Richard
schedule
13.06.2016