Skip to main content

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.

Charts provide powerful visual representations of your water treatment data. The Centinela system supports multiple chart types, each designed for specific monitoring scenarios.

Available Chart Types

The system offers 11 different chart types to visualize your monitoring data:
Visualize percentage or absolute values with animated wave effects.Supported Shapes:
  • Circle (ID: 1)
  • Rectangle (ID: 4)
Use Cases: Tank levels, capacity monitoring, flow percentages
Simple circular progress indicators without animations.Chart ID: 2Use Cases: Quick status indicators, simple progress metrics
Multi-category donut charts with rounded edges.Chart ID: 3Use Cases: Distribution visualization, comparative analysis
Time-series data with overlapping lines.Chart ID: 6Use Cases: Historical trends, multi-variable comparison
Gauge-style speedometer visualization.Chart ID: 8Use Cases: Flow rates, pressure monitoring, speed indicators
LED-style on/off indicators with customizable colors.Chart ID: 9Use Cases: Pump status, valve states, binary sensors
Display multiple LED indicators in a single chart.Chart ID: 10Use Cases: System overview, multi-pump status
Comprehensive dashboard combining charts, pump states, and room status.Chart ID: 11Use Cases: Central monitoring, control room displays

Creating a Chart

1

Navigate to Chart Configuration

Access the configuration menu and select “Charts” to view the chart type selector.
2

Select Chart Type

Choose the appropriate chart type based on your visualization needs. Each card displays a preview and description.
3

Configure Chart Parameters

Fill in the required configuration based on the chart type selected.
4

Save Configuration

Review your settings and save the chart to make it available on the dashboard.

Chart Configuration Reference

Simple Charts (Liquid Fill, Gauge, Circle)

These charts display a single variable with visual styling options.
title
string
required
Display name for the chart (minimum 1 character)
idVar
number
required
ID of the InfluxDB variable to visualize
maxValue
number
required
Maximum value for percentage calculations
order
number
required
Display order on the dashboard (minimum 1)
color
string
default:"#363F9C"
Hexadecimal color code for the chart
unidad
string
Unit of measurement (e.g., “L”, “m³”, “bar”)
porcentage
boolean
default:"true"
Display value as percentage or absolute number
border
boolean
default:"true"
Show border around the chart
shape
string
Shape style: circle or rect (for Liquid Fill charts)
Example Configuration:
{
  title: "Tank A Level",
  idVar: 42,
  maxValue: 1000,
  order: 1,
  color: "#363F9C",
  unidad: "L",
  porcentage: true,
  border: true,
  shape: "circle"
}

Boolean Chart

Visualizes binary states with customizable LED colors and labels.
title
string
required
Chart title
textOn
string
required
Label displayed when state is ON
textOff
string
required
Label displayed when state is OFF
colorOn
string
required
Hexadecimal color for ON state (must be valid hex)
colorOff
string
required
Hexadecimal color for OFF state (must differ from colorOn)
order
number
required
Dashboard display order
Validation Schema:
import { z } from 'zod'

const BooleanChartSchema = z.object({
  title: z.string().min(1, 'Title is required').trim(),
  textOn: z.string().min(1, 'ON text is required').trim(),
  textOff: z.string().min(1, 'OFF text is required').trim(),
  colorOn: z.string()
    .regex(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/, 'Invalid hex color'),
  colorOff: z.string()
    .regex(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/, 'Invalid hex color'),
  order: z.number().min(1)
})
.superRefine((data, ctx) => {
  if (data.colorOn === data.colorOff) {
    ctx.addIssue({
      code: z.ZodIssueCode.custom,
      message: 'ON and OFF colors must be different',
      path: ['colorOn']
    })
  }
})

Pie Chart

Display multiple variables as proportional segments.
title
string
required
Chart title
categories
array
required
Array of category objects defining each segment
Category Object Structure:
categories[].var_id
number
required
Variable ID from InfluxDB
categories[].name
string
required
Display name for the category
categories[].color
string
required
Hexadecimal color for the segment
Example:
{
  title: "Water Distribution",
  type: "PieChart",
  categories: [
    {
      var_id: 15,
      name: "Treatment Area",
      color: "#4CAF50"
    },
    {
      var_id: 16,
      name: "Storage Tanks",
      color: "#2196F3"
    },
    {
      var_id: 17,
      name: "Distribution",
      color: "#FFC107"
    }
  ]
}

Line Chart

Time-series visualization with configurable date ranges.
title
string
required
Chart title
xAxisConfig
object
required
X-axis time configuration
xAxisConfig.dateTimeType
string
required
Time range type: relative or absolute
yData
array
required
Array of variables to plot (minimum 1 variable)
Relative Date Range:
xAxisConfig: {
  dateTimeType: "relative",
  dateRange: "24h",      // e.g., "1h", "6h", "24h", "7d"
  samplingPeriod: "5m"   // e.g., "1m", "5m", "1h"
}
Absolute Date Range:
xAxisConfig: {
  dateTimeType: "absolute",
  dateFrom: "2024-01-01T00:00:00",
  dateTo: "2024-01-31T23:59:59"
}
All timestamps should be in ISO 8601 format for absolute date ranges.

Chart Configuration Object

The configs object in /src/modules/Charts/configs/configs.js defines the requirements for each chart type:
export const configs = {
  1: {
    id: 1,
    typeGraph: 'LiquidFillPorcentaje',
    title: 1,           // 0=Not required, 1=Required, 2=Optional
    value: 1,
    maxValue: 1,
    unity: 2,
    color: 2,
    singleValue: true,
    order: 1,
    preConfig: {
      color: '#363F9C',
      porcentage: 'true',
      shape: 'circle',
      border: 'true'
    }
  }
  // ... additional chart configurations
}
Field requirements are indicated by numeric codes:
  • 0 = Not required
  • 1 = Required
  • 2 = Optional

API Endpoints

Chart configuration uses the following endpoints:
EndpointMethodDescription
/chartsPOSTCreate new chart
/charts/:idGETRetrieve chart configuration
/charts/:idPOSTUpdate existing chart
/chartSeriesPOSTCreate line chart
/chartSeries/:idPOSTUpdate line chart
/piePOSTCreate pie chart
Source Reference: /src/modules/Charts/views/ConfigGraphic.jsx:79-86

Best Practices

  • Use Boolean charts for binary states (pumps, valves)
  • Use Liquid Fill for tank levels and capacities
  • Use Line charts for historical trends
  • Use Gauge for rate-based metrics (flow, pressure)
  • Maintain consistency across similar metrics
  • Use green (#00FF00) for normal/on states
  • Use red/orange for warnings
  • Ensure sufficient contrast for readability
  • Limit line charts to 5-7 variables for optimal rendering
  • Use appropriate sampling periods for historical data
  • Set reasonable date ranges to avoid overwhelming the UI
Charts are automatically added to the dashboard based on their order parameter. Lower numbers appear first.

Build docs developers (and LLMs) love