Creación de un gráfico de anillos planos flexible con JavaScript y SVG-circleDonutChart
| Autor: | vneri |
|---|---|
| Views Total: | 7,542 |
| Sitio oficial: | Ir a la web |
| Actualizado: | November 19, 2018 |
| Licencia: | MIT |
Vista prévia
Descripción
circleDonutChart es una biblioteca de JS independiente para dibujar gráficos de anillos de estilo animado, flexible y plano utilizando objetos SVG .
Funcionamiento
Cargue el circleDonutChart. js necesario en el documento.
<script src="circleDonutChart.js"></script>
Cree un elemento DIV en el que se creará el gráfico de anillos basado en SVG.
<div id="example"></div>
Dibuje un gráfico de anillos animados en el elemento DIV.
var circle = new circleDonutChart('example');
circle.draw({
end:75,
start:0,
maxValue:100,
titlePosition:"outer-top",
titleText:"Your happiness",
outerCircleColor:'#0085c8',
innerCircleColor:'#909081'
}); Available drawing options.
start: starting value, ignored if chart already has a statusend: ending value [mandatory]outerCircleColor: ovverrides the color of outer circleinnerCircleColor: ovverrides the color of inner circletextColor: ovverrides the color of textanimationSpeed = 0: no AnimationanimationSpeed = 1: normal speedscaling: scaling value, 1 for normalsize: in px, the size of the chartgetValue(): gets actual valuesetValue(): sets a value without animationunitText: sets the unit for the shown numbermaxValue: optional parameter that overrides 100% with a maximal ValuetitleText: A title for the Chart (less than 12 chars for inner-bottom and inner-top readibility)titlePosition: where the title gets displayed, [“outer-bottom” | “outer-top” | “inner-bottom” | “inner-top”]titleColor: ovverrides the standard colors for the titleangleOfStart: the standard starting position is at 3 o'clock (90 degrees)- the value can be overridden. Values are from 0 to 360
Métodos:
Draw: dibuja el gráfico en función de las opciones dadasDraw (después del primer sorteo): omitiendo las opciones de color posiblessetValue: establece un valor, sin animar el círculogetValue: devuelve el valor realDelete: eliminar el objeto de gráficoReload: recargue el objeto gráfico e inicialice con parámetros estándar
Registro de cambios
11/19/2018
- Se agregó soporte para ángulos de inicio personalizados





