Subversion Repositories wpShopGermany4

Rev

Rev 5261 | Blame | Compare with Previous | Last modification | View Log | RSS feed

<?php $this->render(WPSG_PATH_VIEW.'/mods/mod_statistics/simplefilter.phtml'); ?>

<?php if (wpsg_isSizedArray($this->view['chart']['data']['records'])) { ?>
<div id="charttopsellertosales-bar" style="height:<?php echo $this->get_option('wpsg_mod_statistics_bar_chart_height'); ?>px; width:<?php echo $this->get_option('wpsg_mod_statistics_bar_chart_width'); ?>px;"></div>

<br />
<h3><?php echo __('Umsatz (prozentual)', 'wpsg'); ?><h3>
<div id="charttopsellertosales-pie-sales" style="height:<?php echo $this->get_option('wpsg_mod_statistics_pie_chart_height'); ?>px; width:<?php echo $this->get_option('wpsg_mod_statistics_pie_chart_width'); ?>px;"></div>

<br />
<h3><?php echo __('Menge (prozentual)', 'wpsg'); ?><h3>
<div id="charttopsellertosales-pie-amount" style="height:<?php echo $this->get_option('wpsg_mod_statistics_pie_chart_height'); ?>px; width:<?php echo $this->get_option('wpsg_mod_statistics_pie_chart_width'); ?>px;"></div>

<br/>

<div id="table-data">
        <?php $this->render(WPSG_PATH_VIEW.'/mods/mod_statistics/charttopsellertosales/data.phtml'); ?> 
</div>

<div class="wpsg_clearer"></div>

<?php 
        $barChartJS = Array();
        $pieChartJS = Array();
        $barChartJS['amount'] = '';
        $barChartJS['payment'] = '';
        $barChartJS['total'] = '';
        
        $pieChartJS['amount'] = '';
        $pieChartJS['sales'] = '';
        
        foreach ($this->view['chart']['data']['records'] as $data) 
        { 
                $barChartJS['payment'] .= "'".wpsg_hspc($data['name'])."', "; 
                $barChartJS['amount'] .= "['".wpsg_hspc($data['name'])."','".wpsg_hspc($data['amount'])."'], "; 
                $barChartJS['total'] .= wpsg_hspc($data['total']).", "; 
                $pieChartJS['amount'] .= "['".wpsg_hspc($data['name'])."', ".wpsg_hspc($data['percent-amount'])."], ";  
                $pieChartJS['sales'] .= "['".wpsg_hspc($data['name'])."', ".wpsg_hspc($data['percent-sales'])."], ";            
        } 
        
        $barChartJS['amount'] = substr($barChartJS['amount'], 0, -2);
        $barChartJS['payment'] = substr($barChartJS['payment'], 0, -2); 
        $barChartJS['total'] = substr($barChartJS['total'], 0, -2); 
        
        $pieChartJS['amount'] = substr($pieChartJS['amount'], 0, -2);
        $pieChartJS['sales'] = substr($pieChartJS['sales'], 0, -2);
        
?>

<script type="text/javascript">
        jQuery(document).ready(function(){
                jQuery.jqplot.config.enablePlugins = true;
            var totals = [<?php echo $barChartJS['total']; ?>];
            var payment = [<?php echo $barChartJS['payment']; ?>];
            var amount = [<?php echo $barChartJS['amount']; ?>];

           //eries:[{renderer:jQuery.jqplot.BarRenderer}, {xaxis:'x2axis', yaxis:'y2axis'}],
                             
            var charttopsellertosalesBar = jQuery.jqplot('charttopsellertosales-bar', [totals, amount], {
                animate: !jQuery.jqplot.use_excanvas,
                axesDefaults: {
                    labelRenderer: jQuery.jqplot.CanvasAxisLabelRenderer
                },
                /*{Each series has same options as seriesDefaults},
                {You can override each series individually here}*/
                series:[
                     {
                         renderer:jQuery.jqplot.BarRenderer,
                         rendererOptions: {
                                varyBarColor: true
                        },
                        pointLabels: { show: true }
                         }, 
                     {
                             xaxis:'x2axis', 
                             yaxis:'y2axis'
                                 }
                ],
                grid: {
                        drawGridLines: false
                },
                axes: {
                    xaxis: {
                        renderer: jQuery.jqplot.CategoryAxisRenderer,
                        ticks: payment,
                        tickRenderer: jQuery.jqplot.CanvasAxisTickRenderer,
                        tickOptions: {
                            angle: -50,
                            fontFamily: 'Arial',
                        fontSize: '10pt',
                        fontWeight: 'normal',
                        textColor: '#666666'
                        },
                        label:'<?php echo wpsg_hspc(wpsg_getStr($this->view['chart']['info']['xaxis']['label'])); ?>',
                        labelOptions: {
                        fontFamily: 'Arial',
                        fontSize: '14pt',
                        fontWeight: 'bold',
                        textColor: '#666666'
                    }
                    },
                    x2axis: {
                        renderer: jQuery.jqplot.CategoryAxisRenderer,
                        label: '',
                        labelRenderer: jQuery.jqplot.CanvasAxisLabelRenderer,
                        tickRenderer: jQuery.jqplot.CanvasAxisTickRenderer,
                        showMarker: false,
                        showTickMarks:false,
                        showticks: false,
                        tickOptions: {
                        }
                    },
                    yaxis:{
                        label:'<?php echo wpsg_hspc($this->view['chart']['info']['yaxis']['label']); ?>',
                        tickRenderer: jQuery.jqplot.CanvasAxisTickRenderer,
                        tickOptions: {
                            fontFamily: 'Arial',
                        fontSize: '8pt',
                        fontWeight: 'normal',
                        textColor: '#666666',
                        formatter: wpsg_statistics_number_format
                        },
                                min:0
                    },
                    y2axis: {
                        label: '<?php echo __('Menge', 'wpsg'); ?>',
                        labelRenderer: jQuery.jqplot.CanvasAxisLabelRenderer,
                        tickRenderer: jQuery.jqplot.CanvasAxisTickRenderer,
                        tickOptions: {
                                showGridline: false,
                            fontFamily: 'Arial',
                            fontSize: '8pt',
                            fontWeight: 'normal',
                            textColor: '#666666',
                            formatter: wpsg_statistics_integer_format
                        },
                        min:0,
                        max: <?php echo $this->view['chart']['data']['y2max']; ?>,
                    }
                },
                highlighter: { show: false }
            });

            var data = [<?php echo $pieChartJS['sales']; ?>];
                  
                var charttopsellertosalesPieSales = jQuery.jqplot ('charttopsellertosales-pie-sales', [data],
                    {
                      seriesDefaults: {
                        renderer: jQuery.jqplot.PieRenderer,
                        rendererOptions: { padding: 50, sliceMargin: 4, showDataLabels: true } 
                      },
                      legend: { show:true, location: 'e' }
                    }
                );

                var data = [<?php echo $pieChartJS['amount']; ?>];
                  
                var charttopsellertosalesPieAmount = jQuery.jqplot ('charttopsellertosales-pie-amount', [data],
                    {
                      seriesDefaults: {
                        renderer: jQuery.jqplot.PieRenderer,
                        rendererOptions: { padding: 50, sliceMargin: 4, showDataLabels: true } 
                      },
                      legend: { show:true, location: 'e' }
                    }
                );
                
            wpsg_statistic_addExportButton();
            
        });
</script>

<style type="text/css">
        .jqplot-x2axis { display:none; }
</style>

<?php } else { ?>
<?php echo __('Keine Daten zur Auswertung vorhanden.', 'wpsg'); ?>
<?php } ?>