Chart Compare
This is meant to be a distributed package for use in allowing chart and graphical comparisons from numerically based django models.
Detailed documentation is in the "docs" directory.
Quick start
Imports
from django_chart_compare import Utils
or:
from django_chart_compare import Compare
Uses
For comparing base data from multiple parent models, you can use the compare module.
Implementation example:
views.py:
from django_chart_compare import Compare
from django.views import generic
from .models import Schedule
...
class ComparisonGraphs(generic.TemplateView):
model = Schedule # your matrix model
template_name = 'app/multi.html'
context_object_name = 'chart'
def get_context_data(self, **kwargs):
context = super(ComparisonGraphs, self).get_context_data(**kwargs)
comp = Compare(Schedule, self.request, **kwargs)
script, div = comp.lane_comp_plotter()
context['html'] = comp.df.to_html()
context['col_dict'] = comp.col_dict
context['name_dict'] = comp.name_dict
context['script'] = script
context['div'] = div
context['schedule'] = Schedule.objects.get(pk=self.kwargs['pk'])
return context
urls.py: The view above needs self.get_context_data() to receive kwargs of pk and slug, where pk is the id of the primary model and the slug is a string with dashes ("-") separating the id's of the comparison models.
url_patterns = [
...
url(r'^schedule/(?P<pk>[0-9_]+)/compare/(?P<slug>[0-9]+(-[0-9]+)*)/more-reports/$',
views.ComparisonGraphs.as_view(), name='more-reports'),
# or if using path in django 2
path('test/<int:pk>/<slug:slug>/', ComparisonGraphs.as_view(), name='test'),
]
And in app/multi.html:
<form action="" method="GET" class="form-horizontal">
<!-- iterate through column values to list all possible selections for comparison -->
{% for pk, sched_columns in col_dict.items %}
<div class="ColumnLists" >
{{ name_dict|get_item:pk }} <br>
<select class="ColumnLists" size="{{ sched_columns|length }}" name="{{ pk }}">
{% for key, col in sched_columns.items %}
<option value="{{ key }}" >
<td>{{ col }}</td>
</option>
{% endfor %}
</select>
</div>
{% endfor %}
</form>
Metadata
Release files for django-chart-compare 1.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django-chart-compare-1.0.4.tar.gz | 5.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_chart_compare-1.0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.4 kB
Release files / django-chart-compare-1.0.4.tar.gz
| Download URL | django-chart-compare-1.0.4.tar.gz |
|---|---|
| Size | 5.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3bc9c142bc2177b7aab614d33f3a8c0a74603a9580e71aadb38016b34e06da9b
|
|
BLAKE2b-256 checksum How to use checksums |
544ef3b0ddfb4a15e72581b13cfe9b45433286999725214de3bd93a3b46f7932
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.1.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.2
|
Release files / django_chart_compare-1.0.4-py3-none-any.whl
| Download URL | django_chart_compare-1.0.4-py3-none-any.whl |
|---|---|
| Size | 5.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fa10d64d60e6f61f5d2bb7352fad05a44d032a6aaedf64b726588ecd53dd4def
|
|
BLAKE2b-256 checksum How to use checksums |
26ec477f1224af32ae4777daaf13f1272b390e82c27bed0d389f9e2514b6ccea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.1.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.2
|