<?php
/**
 * 型号数据
 */

$sql = <<<EOFSQL
SELECT
{:series},
count(DISTINCT sku) sku
FROM gspcatalog_bi.sum_pro
WHERE 1
{:where}
GROUP BY {:series}
EOFSQL;

//统计
$countSql = <<<EOFSQL
SELECT
count(DISTINCT sku)
FROM gspcatalog_bi.sum_pro
WHERE 1
{:where}
EOFSQL;

return [
    'options'=>[
        //轴列
        'axis'=>[],
        //维度
        'series'=>['bigcate','cate','state','region_s','make','mms_source','oeresult','ppic_type'],
        //条件
        'search'=>['bigcate','cate','state','region_s','make','mms_source','oeresult','ppic_type'],
    ],
    'table'=>'sum_pro',
    'sql'=>$sql,
    'fields'=>[
        'axis'=>'',
        'value'=>'sku',
    ],
    'countSql'=>$countSql,
    //'maxCountSql'=>'', //其他统计
    //'series'=>'year', //维度
    'echarts'=>[
        'title'=>[
            'text'=>lg('总型号数'),
            'textStyle'=> $style['title']['textStyle'],
        ],
        'tooltip'=>[
            'trigger'=>'item',
            'formatter'=>'{a} <br/>{b} : {c} ({d}%)',
        ],
        'toolbox'=>[
            'feature'=>[
                'dataView'=>['show'=>true,'readOnly'=>true],
                'magicType'=>['show'=>true,'type'=>['pie']],
                'restore'=>['show'=>true],
                'saveAsImage'=>['show'=>true],
            ]
        ],
        'legend'=>[
            'top'=>'bottom'
        ],
        'series'=>[
            [
                'name'=>'SKU',
                'data'=>[],
                'type'=>'pie',
                'roseType'=>'area',
                'radius'=>['10%', '60%'],
                'center'=>['50%', '50%'],
                'itemStyle'=>[
                    'borderRadius'=>8,
                ],
                /*
                'minMargin'=>5,
                'edgeDistance'=>10,
                'lineHeight'=>15,
                'labelLine'=>[
                    'length'=>15,
                    'length2'=>0,
                    'maxSurfaceAngle'=>80,
                ],
                */
            ],
       ]//series
    ],
];