EC-CUBE4의 관리 화면 매출 그래프가 Chart.js에서 구현되었으므로 사용자 정의 해 보았습니다.
개요
EC-CUBE4의 관리 화면의 매출 그래프가 실장되었으므로 커스터마이즈 해 본 메모
 EC-CUBE4 리포지토리
 EC-CUBE4 문서
 Chart.js 공식 매뉴얼
 Chart.js의 일본어 매뉴얼
 기본
 
 그래프의 좌우에 메모리를 추가
 
/src/Eccube/Resource/template/admin/index.twig의 78 행 근처에서scales: {
    yAxes: [
        {
            id: 'y-axis-1',
            display: true, // trueに変更
            position: 'left', // 左に表示
            ticks: {
                beginAtZero: true,
                callback: function(label, index, labels) {
                    return '¥' + label.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
                }
            }
        },
        {
            id: 'y-axis-2',
            display: true, // trueに変更
            position: 'right', // 右に表示
            ticks: {
                beginAtZero: true,
                stepSize: 50,
                callback: function(label, index, labels) {
                    return label.toString();
                }
            },
            gridLines: { // 件数の横グリッドを消す
                drawOnChartArea: false
            }
        }
    ]
}
 툴팁에 숫자에 세 자리마다 쉼표를 친다.
 
/src/Eccube/Resource/template/admin/index.twig의 70 행 근처에서tooltips: {
    callbacks: {
        label: function(tooltipItem, data) {
            console.log(tooltipItem);
            return tooltipItem.yLabel.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
        }
    }
},
 월간 그래프로 월초부터가 아닌 30일간의 데이터를 표시한다
 
/Users/hideki_okajima/PhpstormProjects/ec-cube/src/Eccube/Controller/Admin/AdminController.php의 271 행 근처    public function sale(Request $request)
    {
        if (!($request->isXmlHttpRequest() && $this->isTokenValid())) {
            return $this->json(['status' => 'NG'], 400);
        }
        // 週間の売上金額
        $toDate = Carbon::now();
        $fromDate = Carbon::today()->subWeek();
        $rawWeekly = $this->getData($fromDate, $toDate, 'Y/m/d');
        // 月間の売上金額
        $fromDate = Carbon::today()->subMonth(); // ここを変更
        $rawMonthly = $this->getData($fromDate, $toDate, 'Y/m/d');
        // 年間の売上金額
        $fromDate = Carbon::now()->subYear()->startOfMonth();
        $rawYear = $this->getData($fromDate, $toDate, 'Y/m');
        $datas = [$rawWeekly, $rawMonthly, $rawYear];
        return $this->json($datas);
    }
                
                    
        
    
    
    
    
    
                
                
                
                
                    
                        
                            
                            
                            Reference
                            
                            이 문제에 관하여(EC-CUBE4의 관리 화면 매출 그래프가 Chart.js에서 구현되었으므로 사용자 정의 해 보았습니다.), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
                                
                                https://qiita.com/okazy/items/e39aa6ed3e7ce4269cc7
                            
                            
                            
                                텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
                            
                            
                                
                                
                                
                                
                                
                                우수한 개발자 콘텐츠 발견에 전념
                                (Collection and Share based on the CC Protocol.)
                            
                            
                        
                    
                
                
                
            

그래프의 좌우에 메모리를 추가
 
/src/Eccube/Resource/template/admin/index.twig의 78 행 근처에서scales: {
    yAxes: [
        {
            id: 'y-axis-1',
            display: true, // trueに変更
            position: 'left', // 左に表示
            ticks: {
                beginAtZero: true,
                callback: function(label, index, labels) {
                    return '¥' + label.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
                }
            }
        },
        {
            id: 'y-axis-2',
            display: true, // trueに変更
            position: 'right', // 右に表示
            ticks: {
                beginAtZero: true,
                stepSize: 50,
                callback: function(label, index, labels) {
                    return label.toString();
                }
            },
            gridLines: { // 件数の横グリッドを消す
                drawOnChartArea: false
            }
        }
    ]
}
 툴팁에 숫자에 세 자리마다 쉼표를 친다.
 
/src/Eccube/Resource/template/admin/index.twig의 70 행 근처에서tooltips: {
    callbacks: {
        label: function(tooltipItem, data) {
            console.log(tooltipItem);
            return tooltipItem.yLabel.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
        }
    }
},
 월간 그래프로 월초부터가 아닌 30일간의 데이터를 표시한다
 
/Users/hideki_okajima/PhpstormProjects/ec-cube/src/Eccube/Controller/Admin/AdminController.php의 271 행 근처    public function sale(Request $request)
    {
        if (!($request->isXmlHttpRequest() && $this->isTokenValid())) {
            return $this->json(['status' => 'NG'], 400);
        }
        // 週間の売上金額
        $toDate = Carbon::now();
        $fromDate = Carbon::today()->subWeek();
        $rawWeekly = $this->getData($fromDate, $toDate, 'Y/m/d');
        // 月間の売上金額
        $fromDate = Carbon::today()->subMonth(); // ここを変更
        $rawMonthly = $this->getData($fromDate, $toDate, 'Y/m/d');
        // 年間の売上金額
        $fromDate = Carbon::now()->subYear()->startOfMonth();
        $rawYear = $this->getData($fromDate, $toDate, 'Y/m');
        $datas = [$rawWeekly, $rawMonthly, $rawYear];
        return $this->json($datas);
    }
                
                    
        
    
    
    
    
    
                
                
                
                
                    
                        
                            
                            
                            Reference
                            
                            이 문제에 관하여(EC-CUBE4의 관리 화면 매출 그래프가 Chart.js에서 구현되었으므로 사용자 정의 해 보았습니다.), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
                                
                                https://qiita.com/okazy/items/e39aa6ed3e7ce4269cc7
                            
                            
                            
                                텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
                            
                            
                                
                                
                                
                                
                                
                                우수한 개발자 콘텐츠 발견에 전념
                                (Collection and Share based on the CC Protocol.)
                            
                            
                        
                    
                
                
                
            
scales: {
    yAxes: [
        {
            id: 'y-axis-1',
            display: true, // trueに変更
            position: 'left', // 左に表示
            ticks: {
                beginAtZero: true,
                callback: function(label, index, labels) {
                    return '¥' + label.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
                }
            }
        },
        {
            id: 'y-axis-2',
            display: true, // trueに変更
            position: 'right', // 右に表示
            ticks: {
                beginAtZero: true,
                stepSize: 50,
                callback: function(label, index, labels) {
                    return label.toString();
                }
            },
            gridLines: { // 件数の横グリッドを消す
                drawOnChartArea: false
            }
        }
    ]
}

/src/Eccube/Resource/template/admin/index.twig의 70 행 근처에서
tooltips: {
    callbacks: {
        label: function(tooltipItem, data) {
            console.log(tooltipItem);
            return tooltipItem.yLabel.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
        }
    }
},
월간 그래프로 월초부터가 아닌 30일간의 데이터를 표시한다
 
/Users/hideki_okajima/PhpstormProjects/ec-cube/src/Eccube/Controller/Admin/AdminController.php의 271 행 근처    public function sale(Request $request)
    {
        if (!($request->isXmlHttpRequest() && $this->isTokenValid())) {
            return $this->json(['status' => 'NG'], 400);
        }
        // 週間の売上金額
        $toDate = Carbon::now();
        $fromDate = Carbon::today()->subWeek();
        $rawWeekly = $this->getData($fromDate, $toDate, 'Y/m/d');
        // 月間の売上金額
        $fromDate = Carbon::today()->subMonth(); // ここを変更
        $rawMonthly = $this->getData($fromDate, $toDate, 'Y/m/d');
        // 年間の売上金額
        $fromDate = Carbon::now()->subYear()->startOfMonth();
        $rawYear = $this->getData($fromDate, $toDate, 'Y/m');
        $datas = [$rawWeekly, $rawMonthly, $rawYear];
        return $this->json($datas);
    }
                
                    
        
    
    
    
    
    
                
                
                
                
                    
                        
                            
                            
                            Reference
                            
                            이 문제에 관하여(EC-CUBE4의 관리 화면 매출 그래프가 Chart.js에서 구현되었으므로 사용자 정의 해 보았습니다.), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
                                
                                https://qiita.com/okazy/items/e39aa6ed3e7ce4269cc7
                            
                            
                            
                                텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
                            
                            
                                
                                
                                
                                
                                
                                우수한 개발자 콘텐츠 발견에 전념
                                (Collection and Share based on the CC Protocol.)
                            
                            
                        
                    
                
                
                
            
    public function sale(Request $request)
    {
        if (!($request->isXmlHttpRequest() && $this->isTokenValid())) {
            return $this->json(['status' => 'NG'], 400);
        }
        // 週間の売上金額
        $toDate = Carbon::now();
        $fromDate = Carbon::today()->subWeek();
        $rawWeekly = $this->getData($fromDate, $toDate, 'Y/m/d');
        // 月間の売上金額
        $fromDate = Carbon::today()->subMonth(); // ここを変更
        $rawMonthly = $this->getData($fromDate, $toDate, 'Y/m/d');
        // 年間の売上金額
        $fromDate = Carbon::now()->subYear()->startOfMonth();
        $rawYear = $this->getData($fromDate, $toDate, 'Y/m');
        $datas = [$rawWeekly, $rawMonthly, $rawYear];
        return $this->json($datas);
    }
Reference
이 문제에 관하여(EC-CUBE4의 관리 화면 매출 그래프가 Chart.js에서 구현되었으므로 사용자 정의 해 보았습니다.), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/okazy/items/e39aa6ed3e7ce4269cc7텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
                                
                                
                                
                                
                                
                                우수한 개발자 콘텐츠 발견에 전념
                                (Collection and Share based on the CC Protocol.)