Metadata-Version: 2.5
Name: cone.charts
Version: 1.1.1
Summary: Chart.js integration into cone
Project-URL: Homepage, http://github.com/conestack/cone.charts
Author-email: Cone Contributors <dev@conestack.org>
License: MIT
License-File: LICENSE.rst
Keywords: cone,node,pyramid,web
Classifier: Environment :: Web Environment
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
Requires-Python: >=3.10
Requires-Dist: cone-app<2.0.0,>1.0.99
Provides-Extra: docs
Requires-Dist: jinja2<3.0; extra == 'docs'
Requires-Dist: markupsafe<2.1.0; extra == 'docs'
Requires-Dist: sphinx; extra == 'docs'
Requires-Dist: sphinx-conestack-theme; extra == 'docs'
Requires-Dist: sphinx-js; extra == 'docs'
Provides-Extra: test
Requires-Dist: cone-app[test]; extra == 'test'
Requires-Dist: pytest; extra == 'test'
Requires-Dist: zope-pytestlayer; extra == 'test'
Description-Content-Type: text/x-rst

.. image:: https://img.shields.io/pypi/v/cone.charts.svg
    :target: https://pypi.python.org/pypi/cone.charts
    :alt: Latest PyPI version

.. image:: https://img.shields.io/pypi/dm/cone.charts.svg
    :target: https://pypi.python.org/pypi/cone.charts
    :alt: Number of PyPI downloads

.. image:: https://github.com/conestack/cone.charts/actions/workflows/test.yml/badge.svg
    :target: https://github.com/conestack/cone.charts/actions/workflows/test.yml
    :alt: Test cone.charts

This package provides `Chart.js <https://www.chartjs.org/>`_ integration in to
``cone.app``.

* Currently version v4.0.1 of ``Chart.js`` is included.

* For building time and date based charts,
  `Luxon <https://github.com/moment/luxon/>`_ v3.0.3 is included.

* For ``Luxon`` integration into ``Chart.js``,
  `chartjs-adapter-luxon <https://github.com/chartjs/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:

.. code-block:: python

    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


Changes
=======

1.1.1 (2026-10-24)
------------------

- Require ``cone.app<2.0.0``. ``cone.app`` 2.0 uses Bootstrap 5, the
  ``1.1.x`` series is for the Bootstrap 3 based ``cone.app`` 1.x.
  [rnix]


1.1.0 (2026-02-03)
------------------

- Refactor package layout to use ``pyproject.toml`` and implicit namespace packages.
  [rnix]

- Setup Makefile.
  [lenadax]

- Run tests with pytest.
  [lenadax]

- Initial work.
  [rnix, toalba, lenadax]


License
=======

MIT License

Copyright (c) 2022-2025, Cone Contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
