Skip to content

examples don't render properly (as advertised) #23

@ursomniac

Description

@ursomniac

I've installed everything, and started by copying examples.
At first I thought this was a miracle (because the setup is so easy and the instructions are so well-written). But then I realized: not one of the example plots (at my end) is rendering properly.

Basically for every 'line' style plot, you get the first two data points stretched out over the entire horizontal part of the plot, no axis labels. The y-axis appears correct.

Since I'm using the exact code you have (for even the 'data': [69, 30, 45, 60, 55] example which is very simple, I don't understand what's missing.

class LineChartTest1(Chart):
    chart_type = 'line'
    
    def get_datasets(self, **kwargs):
        return [{
            'label': "My Dataset",
            'data': [69, 30, 45, 60, 55]
        }]

screen shot 2018-12-26 at 16 05 56

View code:

class Test1View(TemplateView):
    template_name = 'analysis/test1.html'
    
    def get_context_data(self, **kwargs):
        context = super(Test1View, self).get_context_data(**kwargs)
        context['line_chart'] = charts.LineChartTest1()
        return context

Template code:

{% extends "base.html" %}

{% block content %}
<h1> I am a test page! </h1>
<div style="width: 600px;">
{{ line_chart.as_html }}
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.4.0/Chart.bundle.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
{% endblock content %}

Any suggestions would be greatly appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions