Friday, September 23, 2016

how to read django data in javascript from Built-in template tags

in my program  javascript dont read the data which is got from django but the same page html tag the the data.

here is my code
 <script>




       
        var bubbleChartData = {

            datasets: [ {
                label: "Graph of Attacks",
                  backgroundColor:"#FF6384",

            data: '{{ b }}',....................................problam in this line this data cant read.this data sample [{ 'r':15, 'x':45, 'y':5}];
            backgroundColor:"#FF6384",
            hoverBackgroundColor: "#FF6384",
            }]
        };

        window.onload = function() {
            var ctx = document.getElementById("canvas").getContext("2d");
            window.myChart = new Chart(ctx, {
                type: 'bubble',
                data: bubbleChartData,
                options: {
                    responsive: true,
                    title:{
                        display:true,
                        text:'Attack chain'
                    },
                }
            });
        };






    </script>



--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/cb332a15-39f2-4264-980c-c6e511dec6e6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment