Documentation Index
Fetch the complete documentation index at: https://mintlify.com/RubenDarioGuerreroNeira/Ecosistema-IA-Colombia/llms.txt
Use this file to discover all available pages before exploring further.
ChartService converts Chart.js configuration objects into QuickChart image URLs. Because QuickChart renders charts server-side and returns PNG images at a stable URL, charts are delivered as Telegram photo messages (ctx.replyWithPhoto(url)) — no local rendering or image storage required. Every chart variant accepts typed parameters and returns a fully-formed URL that Telegram can fetch and embed inline.
Class: ChartService
ChartService is a plain NestJS @Injectable() service with no constructor dependencies. All state is encoded in the URL it generates.
Method: generateChartUrl
The core URL builder. Serializes any Chart.js config to JSON, URL-encodes it, and appends it to the QuickChart base endpoint alongside width, height, and format parameters.
A Chart.js v2/v3 configuration object. Must include at minimum
type, data.labels, and data.datasets.Image width in pixels. Defaults to
500.Image height in pixels. Defaults to
300.Output format. Defaults to
'png'. QuickChart also supports 'svg' and 'pdf'.A fully-encoded URL such as
https://quickchart.io/chart?w=500&h=300&f=png&c=%7B%22type%22%3A%22bar%22%2C...%7D.Method: generateBarChart
Produces a vertical bar chart with bold data labels above each bar.
- Fill:
rgba(54, 162, 235, 0.5)(semi-transparent blue) - Border:
rgb(54, 162, 235) - Data labels: bold, 14 px, black, anchored to bar tops
- Legend: hidden (title already describes the data)
- Output: 500 × 300 px PNG
Method: generatePieChart
Produces a doughnut chart with percentage labels rendered inside each segment.
#FF6384, #36A2EB, #FFCE56, #4BC0C0, #9966FF, #FF9F40 — cycles for up to 6 segments; longer arrays reuse the first colors.
Data label formula:
Method: generateHorizontalBarChart
Best for datasets with many categories (e.g. vaccination coverage by department). Renders an 18-color horizontal bar chart at 600 × 350 px with percentage suffixes on data labels.
generateChartUrl(config, { width: 600, height: 350 }) explicitly to accommodate longer label text on the y-axis.
Method: generateLineChart
Produces a smooth line chart for time-series data (e.g. disease trends).
- Line color:
rgb(75, 192, 192)(teal) - Fill: disabled
- Tension:
0.1(slight curve) - Output: 500 × 300 px PNG
Sending Charts in Telegram
Charts are delivered as photo messages by callingctx.replyWithPhoto(url) in BotUpdate:
Chart Types by Feature
| Chart Type | Feature | Example query |
|---|---|---|
| Bar | Air quality indicators | "Graficar calidad del aire en Medellín" |
| Bar | SIVIGILA event totals | "Graficar eventos de salud pública" |
| Line | Disease case trend | "Ver tendencia de tuberculosis" |
| Pie / Doughnut | Gender distribution | "Graficar sexo en casos de dengue" |
| Horizontal Bar | Vaccination coverage | "Graficar cobertura de vacunas en Antioquia" |
| Bar | Mental health diagnoses | "Graficar diagnósticos de salud mental" |
| Bar | Cali services by category | "Muéstrame un gráfico de los servicios en Cali" |
Full URL Example
For a bar chart titled “Top Eventos de Salud” with two data points:QuickChart URLs can exceed 2 000 characters for large datasets. For very long label arrays, consider truncating labels to 20 characters or reducing the number of data points before passing them to
generateBarChart.