I'm having difficulty getting Django Chartkick to work when using the library option. The application is somewhat complex but briefly when I do not use the library option the chart renders. When I do it does not render.
More specifically this doesn't render:
{% column_chart count_by_type_type with library= {"title":"Super chart",width:"400px"} %}
This does render
{% column_chart count_by_type_type %}
Thanks for any clues as to why and how to fix.
Edit 20140415
width:"400px"
should be
"width":"400px"
However, that does not resolve the issue.
With "width" changed the chart renders with a title and width with Google Charts. When using Highcharts, however, there is no title.
This appears to be a bug in Django Chartkick when using Highcharts. See https://github.com/mher/chartkick.py/issues/13 and comments.
The underlying problem was that I was using the Google Charts API not the Highcharts API. Thanks to Mher Movsisyan the owner of Django Chartkick for a quick answer on Github.
This is his answer for the benefit of other stackoverflow users:
The configuration formats for Google Charts and HighCharts are
different. You are trying to apply the Google Charts api to
HighCharts.
In this particular example you need to use:
{% pie_chart browser_stats with library={"title":{"text":"Browser Statistics, May 2013"}} %}
See Highcharts API http://www.highcharts.com/docs/chart-concepts/title-and-subtitle
For a fuller discussion see https://github.com/mher/chartkick.py/issues/13
Related
I want to embed a gist containing a Google Chart (rendered here) into this github.io page.
I've tried
<script src="https://cdn.rawgit.com/whanley/71bc1fac509a23b93a3a89b51af32bf8/raw/d98c33c8fbf5ee67a89395c0e435ac9568bcd0c1/dig-eg-gaz-issues-calendar-chart.html"></script>
and
<image src="https://cdn.rawgit.com/whanley/71bc1fac509a23b93a3a89b51af32bf8/raw/d98c33c8fbf5ee67a89395c0e435ac9568bcd0c1/dig-eg-gaz-issues-calendar-chart.html"></image>
and
{% gist 71bc1fac509a23b93a3a89b51af32bf8 %}
but these are not the right thing to do. Help?
Instead of using script or image, I need to use iframe in the code listed above. Works fine now.
I m working on charts using the chart.js library. I want to show image gallery like a carousel on click of any segment of pie/doughnut chart. I'm not able to find the proper solution. Please suggest some solution
If I understand correctly what you are trying is to trigger an event after user clicks on chart segment. chart.js has this prototype method getElementAtEvent(); See the documentation.
It seems as a good place to start - you could create some function to open image gallery and call it there.
And the gallery/slider implementation is a separate issue, but if you are using some of the popular ui libraries some of them have a solution for that already. Bootstrap, for example has carousel, and JQuery has many plugins for that purpose. Here are some examples. Hope this helps...
I am trying to integrate zinnia into a django application. I have to adept the zinnia templates into my theme. Now I am stuck, because it seems that zinnia is using the same template to build the blog entry list, and the blog entry detail page.
This is problematic because, the list has significant different html and css as the entry single view. How do I split the templates, so that I have one that is entirely for the list and one for the entry's detail (Single Post) ?
To the best of my knowledge this isn't easily done. Here is a comment on a bug asking about this very issue:
Template Documentation #383
For me I am going to modify zinnia/_entry_detail_base.html and put my list view template code in an {% if continue_reading %} and the detail template in the else branch.
I'm currently in the process of integrating the Zinnia engine into custom templates -- I'm working on a dynamically updating homepage that shows recent entries from multiple categories, custom pages for each of those categories, and then custom templates for the entries' detail views. I've found this question's answer and this explanation to be extremely helpful.
*Keep in mind that the second link is a bit dated, and that {% load zinnia_tags %} is now {% load zinnia %}.
It's still a lot of trial and error to get things adapted properly to a custom template, but Zinnia really is amazingly customizable, and I think its default configuration tends to overshadow the fact that it works brilliantly as an underlying engine that can power just about any framework that you can sketch out on a notepad.
As the documentation notes, it's also helpful to take a look at some custom themes built for Zinnia on GitHub, just to get a feel of how the template tags are implemented, and how the default templates can be overridden. Here's the repo for a Bootstrap theme, and here's one for a Foundation theme.
Sorry up front if my terminology will be non-standard, but I am new to Django and Python...I am using Python 2.7.3 and Django 1.4.3 on a Mac OSX 10.7 (Lion). Django-autocomplete-light version 1.1.7.
I am using the django-autocomplete-light module to create a page where I can search within a set of videos (hosted on an external source like Youtube). I defined a model / app called Videos that contains a set of videos hosted on this third-party site. At the top of my videos/index.html page, I have a search box that is powered by the django-autocomplete-light module. I have gotten the overall search function working--when I type something into the search box, the relevant videos are shown in the drop-down menu automatically. I want the clicked video to play within an embedded player on the page--for some reason, this keeps on loading the video into the entire, existing document / page instead of just the iFrame. In my structure for the search box, I included the "target" attribute already. My understanding is that including "target" should work, but I must be missing something. When I check Firebug, the "target" attribute is included in the link in the search results (sorry, can't post a screenshot of this since I don't have enough reputation points...but it's there. The iFrame also has its "name" attribute assigned to the same thing).
Side note--I am hosting the video on a private service (not Youtube), so I prefer not to use a library like jQuery TubePlayer...but the concept remains the same).
My questions--is there another way to do this? Am I missing something obvious? Does django-autocomplete-light not play nice with iFrames?
(templates/videos/index.html)
<iframe name="tvplayer" width="560" height="315" src="http://www.youtube.com/embed/CE0Q904gtMI" frameborder="0" allowfullscreen></iframe>
(navigation_autocomplete/autocomplete.html)--I understand that all videos will return the same link using this code, but I can't even get this one to work!
{% for video in videos %}
<a style="display:block" href="http://www.youtube.com/embed/3svKWr9LH4I" target="tvplayer">{{ video.title }} - {{ video.desc }}</a>
{% endfor %}
Thanks for your help!
Solved my own question...within the navigation_autocomplete/script.html page, you have to change the navigation_autocomplete javascript handler directly since it overrides any other styling / parameters that you put into the a tag.
I had done this with markdown before following the book practical django projects but now I wish to use CKEditor on my blog and it just spits out the raw HTML I've checked docs. I imagine I am just not using the correct filter? IF anybody knows the answer please let me know. Thanks
If you want to display HTML on your template you need to use the safe filter (documentation).
Example:
{{ my_html_text|safe }}