当只有一个数据存在时,披萨饼图问题

时间:2017-03-17 11:52:55

标签: javascript charts pie-chart

我正在使用披萨饼图。 http://zurb.com/playground/pizza-pie-charts

<div class="col-md-12 col-sm-12">
    <div class="portlet light bordered">
        <div class="portlet-title">
            <div class="caption">
                <i class="icon-graph font-green"></i>
                <span class="caption-subject font-green bold uppercase">Overall Customer Experience</span>
                <!--<span class="caption-helper">Feedback based on customer experiences</span>-->
            </div>
            <div class="actions">
            </div>
        </div>
        <div class="portlet-body">
            <div class="row">
                <div class="col-lg-6 col-sm-6">
                    <div id="pie"></div>
                </div>
                <div class="col-lg-6 col-sm-6">
                    <ul data-pie-id="pie" class="pie-list">
                        <li data-value="<?php echo $experience_2;?>" data-text="Sad {{percent}} ({{ value }})"><img src="<?php echo base_url();?>uploads/smiley/dashboard/2.png">Sad</li>
                        <li data-value="<?php echo $experience_3;?>" data-text="Confused {{percent}} ({{ value }})"><img src="<?php echo base_url();?>uploads/smiley/dashboard/3.png">Confused</li>
                        <li data-value="<?php echo $experience_4;?>" data-text="Good {{percent}} ({{ value }})"><img src="<?php echo base_url();?>uploads/smiley/dashboard/4.png">Good</li>
                        <li data-value="<?php echo $experience_5;?>" data-text="Very Good {{percent}} ({{ value }})"><img src="<?php echo base_url();?>uploads/smiley/dashboard/5.png">Very Good</li>


                    </ul>
                </div>

            </div>
        </div>
    </div>
</div>

在本节中,我将介绍来自PHP的数据。

<ul data-pie-id="pie" class="pie-list">
        <li data-value="<?php echo $experience_2;?>" data-text="Sad {{percent}} ({{ value }})"><img src="<?php echo base_url();?>uploads/smiley/dashboard/2.png">Sad</li>
        <li data-value="<?php echo $experience_3;?>" data-text="Confused {{percent}} ({{ value }})"><img src="<?php echo base_url();?>uploads/smiley/dashboard/3.png">Confused</li>
        <li data-value="<?php echo $experience_4;?>" data-text="Good {{percent}} ({{ value }})"><img src="<?php echo base_url();?>uploads/smiley/dashboard/4.png">Good</li>
        <li data-value="<?php echo $experience_5;?>" data-text="Very Good {{percent}} ({{ value }})"><img src="<?php echo base_url();?>uploads/smiley/dashboard/5.png">Very Good</li>
</ul>

现在的问题是, 当$ experience_2 = 0,$ experience_3 = 0,$ experience_4 = 0和$ experience_5 = 3时,图表不会加载。只要任何三个值为零,图表就不会加载。

我该如何解决这个问题?

0 个答案:

没有答案