Gráficos y visualización · jdashboardUI 23.5 · B4J / JavaFX
Gráfico donut completo o semicircular con gaps, gradientes, leyenda, texto/icono central y exportación PNG.
La imagen mostrada en esta página es una referencia visual creada para la documentación. No pretende ser una captura pixel-perfect del control; el resultado real depende del tamaño, tema, colores y datos.
Características destacadas
- Exportación PNG
- Animación configurable
- Gradientes
- Título configurable
- Interacción por clic
Cuándo usarlo
Gráfico donut completo o semicircular con gaps, gradientes, leyenda, texto/icono central y exportación PNG.
Designer Properties
| Property | Type | Default | Description |
|---|---|---|---|
| StrokeWidth | Int | 10 |
Width of the donut segments. |
| InnerRadiusFactor | Float | 0.6 |
Factor for inner radius (0 to 1). |
| GapAngle | Int | 5 |
Angle of gap between segments (degrees). |
| TitleText | String | `` | Title to display at the top. |
| TitleTextSize | Int | 16 |
Font size of the title text. |
| AnimationDuration | Int | 2000 |
Animation duration in milliseconds. |
| UseGradients | Boolean | False |
Use gradient colors for segments. |
| PercentageSuffix | String | % |
Suffix for percentage in legend. |
| LegendTextColor | Color | 0xFF000000 |
Color of the legend text. |
| IsHalfDonut | Boolean | False |
Display as half donut (180 degrees). |
Creación y ciclo de vida
Private JDonutChart1 As JDonutChart
JDonutChart1.Initialize(Me, "JDonutChart1")
JDonutChart1.AddToParent(Root, 20dip, 20dip, 640dip, 360dip)
Ejemplo funcional
Dim Values As List
Values.Initialize2(Array As Double(45, 30, 25))
Dim Labels As List
Labels.Initialize2(Array As String("Desktop", "Mobile", "Tablet"))
Dim Colors As List
Colors.Initialize2(Array As Int(0xFF4F46E5, 0xFF06B6D4, 0xFFF59E0B))
JDonutChart1.SetData(Values, Labels, Colors)
JDonutChart1.TitleText = "Traffic"
Propiedades B4X normalizadas
Los accesores públicos getX/setX compatibles se presentan como propiedades B4X normales. Los métodos parametrizados siguen documentándose como métodos.
| Propiedad | Acceso | Tipo |
|---|---|---|
| TitleTextFont | write | B4XFont |
| TitleTextSize | write | Float |
| TitleText | write | String |
| TitleTextColor | write | Int |
| LegendTextColor | write | Int |
| UseGradients | write | Boolean |
| PercentageSuffix | write | String |
Eventos
MouseClicked
Exportación y renderizado
Cuando el módulo expone SaveAsPNG / SavePNG, puedes guardar el estado renderizado del control directamente a PNG. Comprueba el Boolean devuelto cuando exista.
Notas y comportamiento real de la versión analizada
- Admite IsHalfDonut desde el Designer, además de icono o texto central.
API pública completa
Initialize(Callback As Object, EventName As String)AddToParent(Parent As B4XView, Left As Int, Top As Int, Width As Int, Height As Int)SetData(listvalues As List, listlabels As List, listcolors As List)setTitleTextFont(Font As B4XFont)setTitleTextSize(Size As Float)setTitleText(Title As String)setTitleTextColor(Color As Int)setLegendTextColor(Color As Int)setUseGradients(Value As Boolean)setPercentageSuffix(Suffix As String)setIconCenter(Icon As Char,color As Int ,font As Font)setTextCenter(SubText As String,color As Int ,font As Font)SaveAsPNG(Dir As String, FileName As String, BackgroundColor As Int) As Boolean
Componentes relacionados
- JPieChart
- JCircularProgressBar
- JGaugeProgress