Skip to content
Related Articles

Related Articles

Solid Gauge Chart in Pygal
  • Last Updated : 10 Jul, 2020

Pygal is a Python module that is mainly used to build SVG (Scalar Vector Graphics) graphs and charts. SVG is a vector-based graphics in the XML format that can be edited in any editor. Pygal can create graphs with minimal lines of code that can be easy to understand and write.

Solid Gauge Chart

Gauges are the popular charts which help for dashboards, they anticipate a number in a range at a glance. It can use colored bands, hands, and combinations to display multiple values and their relation to a numeric scale.

Syntax:

gauge = pygal.SolidGauge()

Example 1:

Python3






# importing pygal
import pygal
  
# creating the chart object
Solid_Gauge = pygal.SolidGauge(inner_radius = 0.75)
  
# naming the title
Solid_Gauge.title = 'Solid Gauge Chart'     
  
# Random data
Solid_Gauge.add('A', [{'value': 1000, 'max_value': 5000}])
Solid_Gauge.add('B', [{'value': 12, 'max_value': 20}])
Solid_Gauge.add('C', [{'value': 99, 'max_value': 100}])
  
Solid_Gauge

Output:

Example 2:

Python3




# importing pygal
import pygal
  
# creating the chart object
Solid_Gauge = pygal.SolidGauge(inner_radius = 0.75
                               half_pie = True)
  
# naming the title
Solid_Gauge.title = 'Solid Gauge Chart'     
  
# Random data
Solid_Gauge.add('A', [{'value': 1000, 'max_value': 5000}])
Solid_Gauge.add('B', [{'value': 12, 'max_value': 20}])
Solid_Gauge.add('C', [{'value': 99, 'max_value': 100}])
  
Solid_Gauge

Output:

 Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.  

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course

My Personal Notes arrow_drop_up
Recommended Articles
Page :