{"id":13468818,"url":"https://github.com/peopledoc/django-chartjs","last_synced_at":"2025-05-15T21:07:11.038Z","repository":{"id":8896836,"uuid":"10618320","full_name":"peopledoc/django-chartjs","owner":"peopledoc","description":"Django Class Based Views to generate Ajax charts js parameters.","archived":false,"fork":false,"pushed_at":"2024-04-11T11:51:18.000Z","size":636,"stargazers_count":407,"open_issues_count":5,"forks_count":110,"subscribers_count":33,"default_branch":"master","last_synced_at":"2025-05-10T16:54:31.342Z","etag":null,"topics":["approved-public","ghec-mig-migrated"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"codeschool-kiddo-level-2-complete/dojo_rules","license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/peopledoc.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.rst","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-06-11T09:21:40.000Z","updated_at":"2025-03-20T15:42:42.000Z","dependencies_parsed_at":"2024-06-18T15:31:16.831Z","dependency_job_id":"f1244e38-c470-4596-aa74-e25222db5f5c","html_url":"https://github.com/peopledoc/django-chartjs","commit_stats":{"total_commits":117,"total_committers":24,"mean_commits":4.875,"dds":0.7606837606837606,"last_synced_commit":"e3c72c948fe8a905a5ee696c8cca9217941058a6"},"previous_names":["novafloss/django-chartjs"],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peopledoc%2Fdjango-chartjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peopledoc%2Fdjango-chartjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peopledoc%2Fdjango-chartjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peopledoc%2Fdjango-chartjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/peopledoc","download_url":"https://codeload.github.com/peopledoc/django-chartjs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254422761,"owners_count":22068678,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["approved-public","ghec-mig-migrated"],"created_at":"2024-07-31T15:01:19.706Z","updated_at":"2025-05-15T21:07:10.985Z","avatar_url":"https://github.com/peopledoc.png","language":"JavaScript","readme":"Django Chartjs\n##############\n\nDjango Chartjs lets you manage charts in your Django application.\n\n.. image:: https://travis-ci.org/peopledoc/django-chartjs.svg?branch=master\n   :target: https://travis-ci.org/peopledoc/django-chartjs\n.. image:: https://coveralls.io/repos/peopledoc/django-chartjs/badge.png?branch=master\u0026style=flat\n   :target: https://coveralls.io/r/peopledoc/django-chartjs?branch=master\n.. image:: https://img.shields.io/pypi/v/django-chartjs.svg\n   :target: https://pypi.python.org/pypi/django-chartjs/\n\n\nThis is compatible with Chart.js and Highcharts JS libraries.\n\nUsing a set of predefined Class Based Views you are able to get\nstarted after writing just your SQL query.\n\n* Authors: Rémy Hubscher and `contributors\n  \u003chttps://github.com/peopledoc/django-chartjs/graphs/contributors\u003e`_\n* Licence: BSD\n* Compatibility: Django 1.10, 2.2 and 3.0, python3.6 up to python3.8\n* Project URL: https://github.com/peopledoc/django-chartjs\n\n\nGetting Started\n===============\n\nInstall django-chartjs::\n\n    pip install django-chartjs\n\n\nAdd it to your ``INSTALLED_APPS`` settings::\n\n    INSTALLED_APPS = (\n        '...',\n        'chartjs',\n    )\n\n\nUsing it\n========\n\nA simple Line Chart example.\n\n1. Create the HTML file\n+++++++++++++++++++++++\n\n.. code-block:: html\n\n    {% load static %}\n    \u003chtml\u003e\n        \u003chead\u003e\n            \u003ctitle\u003edjango-chartjs line chart demo\u003c/title\u003e\n            \u003c!--[if lte IE 8]\u003e\n                \u003cscript src=\"{% static 'js/excanvas.js' %}\"\u003e\u003c/script\u003e\n            \u003c![endif]--\u003e\n        \u003c/head\u003e\n        \u003cbody\u003e\n            \u003ch1\u003eSome Line Charts loaded in Ajax!\u003c/h1\u003e\n            \n            \u003ccanvas id=\"myChart\" width=\"500\" height=\"400\"\u003e\u003c/canvas\u003e\n    \n            \u003cscript type=\"text/javascript\" src=\"http://code.jquery.com/jquery-1.10.0.min.js\"\u003e\u003c/script\u003e\n            \u003cscript type=\"text/javascript\" src=\"{% static 'js/Chart.min.js' %}\"\u003e\u003c/script\u003e\n            \u003cscript type=\"text/javascript\"\u003e\n                $.get('{% url \"line_chart_json\" %}', function(data) {\n                    var ctx = $(\"#myChart\").get(0).getContext(\"2d\");\n                    new Chart(ctx, {\n                        type: 'line', data: data\n                    });\n                });\n            \u003c/script\u003e\n        \u003c/body\u003e\n    \u003c/html\u003e\n\n\n2. Create the view with labels and data definition\n++++++++++++++++++++++++++++++++++++++++++++++++++\n\n.. code-block:: python\n\n    from django.views.generic import TemplateView\n    from chartjs.views.lines import BaseLineChartView\n    \n    \n    class LineChartJSONView(BaseLineChartView):\n        def get_labels(self):\n            \"\"\"Return 7 labels for the x-axis.\"\"\"\n            return [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\"]\n\n        def get_providers(self):\n            \"\"\"Return names of datasets.\"\"\"\n            return [\"Central\", \"Eastside\", \"Westside\"]\n\n        def get_data(self):\n            \"\"\"Return 3 datasets to plot.\"\"\"\n    \n            return [[75, 44, 92, 11, 44, 95, 35],\n                    [41, 92, 18, 3, 73, 87, 92],\n                    [87, 21, 94, 3, 90, 13, 65]]\n    \n    \n    line_chart = TemplateView.as_view(template_name='line_chart.html')\n    line_chart_json = LineChartJSONView.as_view()\n\n    \n3. Update urls.py with the new urls for TemplateView and AJAX call 'line_chart_json' as in chart.html\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\n.. code-block:: python\n\n    from .views import line_chart, line_chart_json\n    \n    urlpatterns = [\n      '...',\n      path('chart', line_chart, name='line_chart'),\n      path('chartJSON', line_chart_json, name='line_chart_json'),\n    ]\n\n\n4. Get a Chart.js Line Chart\n++++++++++++++++++++++++++++\n\n.. image:: https://raw.github.com/peopledoc/django-chartjs/master/docs/_static/django-chartjs.png\n\n\nIt is that simple!\n\nFor other examples including a HighCharts line chart, don't hesitate to look at the demo project.\n\nAlso, feel free to contribute your demo!\n","funding_links":[],"categories":["JavaScript","Integrations"],"sub_categories":["Others"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeopledoc%2Fdjango-chartjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpeopledoc%2Fdjango-chartjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeopledoc%2Fdjango-chartjs/lists"}