Skip to content

conestack/cone.charts

Repository files navigation

Latest PyPI version Number of PyPI downloads Package build https://coveralls.io/repos/github/bluedynamics/cone.charts/badge.svg?branch=master

This package provides Chart.js integration in to cone.app.

  • Currently version v4.0.1 of Chart.js is included.
  • For building time and date based charts, Luxon v3.0.3 is included.
  • For Luxon integration into Chart.js, chartjs-adapter-luxon is required which is included in version v1.2.1.

Resources

The following cone.charts related application configuration options are available:

  • cone.charts.luxon: Flag whether Luxon resources are delivered to browser. Defaults to false.

Chart Tile

Some chart basic tiles are available in cone.charts.

The following example shows how to implement a linechart:

from cone.charts.browser.chart import chart_tile
from cone.charts.browser.chart import LineChartTile

@chart_tile(
    name='my_linechart',
    interface=MyModel,
    permission='view')
class MyLineChart(LineChartTile):

    @staticmethod
    def chart_data(model, request):
        return {
            'labels': ['Label 1', 'Label 2'],
            'datasets': [{
                'data': [10, 20],
                'borderColor': 'rgb(255,0,0)',
                'tension': 0.3,
                'label': 'Dataset Label',
            }],
        }

Please refer to the source code in cone.charts.browser package for available chart tiles.

Contributors

  • Robert Niederreiter
  • Torben Baumgartner
  • Lena Daxenbichler

About

chart.js integration into cone

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published