Introduction
The following release introduces a zenaura-ui charts which is integration with chartjs inside the frameowrk, with a starter charts that we plan to extend in the future.
example of component usage :
from zenaura.client.mutator import mutator
from zenaura.graph.charts import ChartThis, Canvas
from zenaura.client.component import Component
# Data for the chart
labels = ["January", "February", "March", "April", "May", "June", "July"]
data = {
"labels": labels,
"datasets": [{
"label": "My First Dataset",
"backgroundColor": "rgba(255, 99, 132, 0.2)",
"borderColor": "rgb(255, 99, 132)",
"data": [65, 59, 80, 81, 56, 55, 40],
}]
}
# Configuration options
config = {
"type": "bar",
"data": data,
"options": {}
}
class Chart(Component):
def __init__(self):
self.chart_name = "barchart"
@mutator
async def attached(self):
ChartThis(config, self.chart_name)
def render(self):
return Canvas(self.chart_name)