Documentation Index Fetch the complete documentation index at: https://mintlify.com/CspmIT/centinela-front/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Charts in Centinela provide real-time and historical visualization of monitoring variables. The system supports multiple chart types for different data visualization needs.
Chart Types
LineChart : Time-series line graphs
BarChart : Bar chart comparisons
PieChart / DoughnutChart : Proportion visualizations
BooleanChart : Binary state indicators
MultipleBooleanChart : Multiple boolean state displays
BoardChart : Dashboard containers with multiple charts
PumpControl : Pump status and control interface
List All Charts
Retrieve all configured charts:
curl -X GET "https://masagua.cooptech.com.ar/api/allCharts" \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json"
Response:
{
"data" : [
{
"id" : 1 ,
"name" : "Caudal Diario Planta Principal" ,
"type" : "LineChart" ,
"order" : 1 ,
"status" : 1
},
{
"id" : 2 ,
"name" : "Distribución Consumo por Sector" ,
"type" : "PieChart" ,
"order" : 2 ,
"status" : 1
},
{
"id" : 3 ,
"name" : "Estado Bombas Principales" ,
"type" : "MultipleBooleanChart" ,
"order" : 3 ,
"status" : 1
},
{
"id" : 4 ,
"name" : "Panel Indicadores Principales" ,
"type" : "BoardChart" ,
"order" : 0 ,
"status" : 1
}
]
}
Chart type (LineChart, BarChart, PieChart, etc.)
Display order in dashboard
Active status (1 = active, 0 = inactive)
Get Charts for Indicators
Retrieve charts configured for dashboard indicators:
curl -X GET "https://masagua.cooptech.com.ar/api/indicatorCharts" \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json"
Response:
{
"data" : [
{
"id" : 1 ,
"name" : "Presión Red Principal" ,
"type" : "LineChart" ,
"order" : 1 ,
"status" : 1 ,
"ChartData" : [
{
"id" : 1 ,
"chart_id" : 1 ,
"influx_var_id" : 12 ,
"InfluxVars" : {
"id" : 12 ,
"name" : "Presión Principal" ,
"unit" : "bar" ,
"type" : "last" ,
"calc" : false ,
"varsInflux" : { /* ... */ }
}
}
],
"ChartConfig" : [
{
"id" : 1 ,
"chart_id" : 1 ,
"key" : "line.color" ,
"value" : "#3b82f6"
},
{
"id" : 2 ,
"chart_id" : 1 ,
"key" : "line.width" ,
"value" : "2"
}
]
}
]
}
Array of variable associations for the chart
Array of configuration key-value pairs for chart styling
Update Chart Status
Activate or deactivate a chart:
curl -X PUT "https://masagua.cooptech.com.ar/api/charts/status" \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json" \
-d '{
"id": 1,
"status": 1
}'
Current status (will be toggled: 1 → 0, 0 → 1)
Response:
Chart Configuration Keys
Line Chart
Line color (hex format, e.g., #3b82f6)
Whether to fill area under line
Line curve tension (0 = straight, 0.4 = smooth)
Bar Chart
Pie/Doughnut Chart
Array of colors for segments
Center cutout percentage (e.g., “50%“)
Boolean Chart
Color when value is true/ON
Color when value is false/OFF
Label text for true state
Label text for false state
Board Chart
Chart ID for top-left position
Chart ID for top-right position
Number of columns in board layout
Get Multiple Influx Data
Retrieve real-time values for multiple variables (used for live chart updates):
curl -X POST "https://masagua.cooptech.com.ar/api/multipleDataInflux" \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json" \
-d '[
{
"dataInflux": {
"id": 12,
"name": "Presión Principal",
"unit": "bar",
"varsInflux": {
"Presión Principal": {
"calc_topic": "presion/principal",
"calc_field": "value",
"calc_time": 30,
"calc_unit": "s",
"calc_period": 10,
"calc_unit_period": "s",
"calc_type_period": "last"
}
}
}
},
{
"dataInflux": {
"id": 8,
"name": "Cloro Residual",
"unit": "mg/L",
"varsInflux": { /* ... */ }
}
}
]'
Response:
{
"data" : {
"12" : 4.2 ,
"8" : 0.85
}
}
The response is a map of variable ID to current value.
This endpoint is typically called every 30 seconds for real-time chart updates.
Example: Creating a Line Chart
While the full chart creation endpoint isn’t shown in the source, charts are typically configured with:
Chart metadata : name, type, order
Data associations : link to variables
Configuration : styling and behavior
// Example configuration structure
const chartConfig = {
name: "Presión Últimas 24 Horas" ,
type: "LineChart" ,
order: 1 ,
status: 1 ,
data: [
{
influx_var_id: 12 ,
label: "Presión Principal"
}
],
config: [
{ key: "line.color" , value: "#3b82f6" },
{ key: "line.width" , value: "3" },
{ key: "line.fill" , value: "true" },
{ key: "line.tension" , value: "0.4" }
]
};
Chart Polling Pattern
For real-time charts, implement polling:
const updateCharts = async () => {
// Extract all variables from charts
const allVars = charts . flatMap ( chart =>
chart . ChartData . map ( item => ({
dataInflux: item . InfluxVars
}))
);
// Fetch current values
const { data } = await request (
` ${ baseUrl } /multipleDataInflux` ,
'POST' ,
allVars
);
// Update chart data
setInfluxValues ( data );
};
// Poll every 30 seconds
const interval = setInterval ( updateCharts , 30000 );
Board Chart Layout
Board charts act as containers for other charts:
{
"type" : "BoardChart" ,
"ChartConfig" : [
{ "key" : "board.top.leftChartId" , "value" : "5" },
{ "key" : "board.top.rightChartId" , "value" : "6" }
]
}
This creates a board with two charts side-by-side.
Boolean Charts
Display binary states (pump ON/OFF, valve open/closed):
{
"type" : "BooleanChart" ,
"ChartData" : [
{
"influx_var_id" : 25 ,
"InfluxVars" : {
"name" : "Bomba Principal" ,
"type" : "last"
}
}
],
"ChartConfig" : [
{ "key" : "boolean.trueColor" , "value" : "#22c55e" },
{ "key" : "boolean.falseColor" , "value" : "#ef4444" },
{ "key" : "boolean.trueLabel" , "value" : "ENCENDIDA" },
{ "key" : "boolean.falseLabel" , "value" : "APAGADA" }
]
}
Multiple Boolean Charts
Display multiple boolean variables in a grid:
{
"type" : "MultipleBooleanChart" ,
"ChartData" : [
{ "influx_var_id" : 25 , "InfluxVars" : { "name" : "Bomba 1" } },
{ "influx_var_id" : 26 , "InfluxVars" : { "name" : "Bomba 2" } },
{ "influx_var_id" : 27 , "InfluxVars" : { "name" : "Bomba 3" } }
]
}
Chart Types Reference
LineChart
BarChart
PieChart
BooleanChart
BoardChart
Time-series line graph for continuous variables like pressure, flow, temperature. Best for : Trends over time, historical analysis
Bar chart for comparing discrete values or categories. Best for : Comparisons, daily/weekly summaries
Circular chart showing proportions. Best for : Distribution, percentages
Binary state indicator (ON/OFF, open/closed). Best for : Equipment status, digital signals
Container for multiple charts in a dashboard layout. Best for : Overview dashboards, control panels
Next Steps
Variables Configure variables for charts
Diagrams Create interactive system diagrams