开发者

My Jqplot pie chart is being displayed without any color for the small table inside the pie chart

开发者 https://www.devze.com 2023-03-27 11:58 出处:网络
i am using Jqplot pie chart inside my asp.net MVC 3 web application , but the problem is that the small table inside the pie chart which contains the chart label are being display without any color.

i am using Jqplot pie chart inside my asp.net MVC 3 web application , but the problem is that the small table inside the pie chart which contains the chart label are being display without any color. So how i can solve this issue?. Thanks in advance for any help. BR

Edited

thanks for ur kind reply, yes i have included these files , but still no colors are shown. here is the code inside my MVC 3 asp.net web application(the pie chart shows two values ;the percentage of students who like a test to the students who did not provide any Rating ).

<script src="../../Scripts/jqplot/jquery.jqplot.min.js" type="text/javascript"></script>
<script src="../../Scripts/jqplot/jqplot.pieRenderer.min.js" type="text/javascript"></script>
<script src="../../Scripts/jqplot/jqplot.donutRenderer.min.js" type="text/javascript"></script>
<script src="../../Scripts/jqplot/jqplot.barRenderer.min.js" type="text/javascript"></script>
<script src="../../Scripts/jqplot/jqplot.categoryAxisRenderer.min.js" type="text/javascript"></script>
<script src="../../Scripts/jqplot/jqplot.pointLabels.min.js" type="text/javascript"></script>
<script type="text/开发者_StackOverflow中文版javascript">
    $(document).ready(function () {
        var data = [
                 ['Number of Like', @ViewBag.CountRate], ['Other', @ViewBag.other]
                   ];
        var plot1 = jQuery.jqplot('r1', [data],
    {
        seriesDefaults: {
            renderer: jQuery.jqplot.PieRenderer,
            rendererOptions: {
                showDataLabels: true
            }
        },
        legend: { show: true, location: 'e' }
    }
  );
    });
</script>

 <div id = "r1"></div>


jqPlot documentation doesn't mention it very strongly but it does mention to include the css file

To use jqPlot include jquery, the jqPlot jQuery plugin, jqPlot css file and optionally the excanvas script for IE support in your web page

So you need to include jquery.jqplot.min.css e.g.

<link rel="stylesheet" href="/jqplot/jquery.jqplot.min.css">

Also jqPlot recommends using css to customize colors etc see http://www.jqplot.com/docs/files/jqPlotCssStyling-txt.html


are you loading all the required js files? sounds like you are missing:

jqplot.pointLabels.min.js

add these:

("~/scripts/jqPlot/jquery.jqplot.min.js")
("~/scripts/jqPlot/plugins/jqplot.pieRenderer.min.js")
("~/scripts/jqPlot/plugins/jqplot.donutRenderer.min.js")
("~/scripts/jqPlot/plugins/jqplot.barRenderer.min.js")
("~/scripts/jqPlot/plugins/jqplot.categoryAxisRenderer.min.js")
("~/scripts/jqPlot/plugins/jqplot.pointLabels.min.js")
0

精彩评论

暂无评论...
验证码 换一张
取 消