The Pie Chart Widget in OpenLIT is perfect for showing how values are distributed across categories. Use it to represent proportions such as traffic sources, user roles, or error types.

πŸ“Œ Use Cases

  • Visualize category breakdowns
  • Show relative proportions of segments (e.g. users by role)
  • Highlight top contributors to a total value
  • Display simple summaries at a glance

πŸ› οΈ How to Add a Pie Chart

Example:
WITH
	parseDateTimeBestEffort('{{filter.timeLimit.start}}') AS start_time,
	parseDateTimeBestEffort('{{filter.timeLimit.end}}') AS end_time,
	
	SELECT
		DISTINCT ResourceAttributes['service.name'] as applicationName,
		ROUND(SUM(toFloat64OrZero(SpanAttributes['gen_ai.usage.cost'])), 5) AS cost
	FROM otel_traces
	WHERE
		SpanAttributes['gen_ai.operation.name'] != 'vectordb'
		AND notEmpty(SpanAttributes['gen_ai.usage.cost'])
		AND notEmpty(ResourceAttributes['service.name'])
		AND StatusCode IN ('STATUS_CODE_OK', 'STATUS_CODE_UNSET', 'Ok', 'Unset')
		AND Timestamp >= start_time AND Timestamp <= end_time
	GROUP BY applicationName;

βš™οΈ Configuration Options

  • Customize colors
  • Add paths for labels & values
Use dynamic bindings like {{filter.timeLimit.start}}, {{filter.timeLimit.end}} to make your chart respond to dashboard time filters.

βœ… Best Practices

  • Aggregate less-important categories into an β€œOther” group in SQL
  • Use percent labels for quick at-a-glance insights
  • Match colors with your product or brand theme for consistency