Skip to content

Commit

Permalink
Replaced google dashboard charts with Chart.js (via composer) (#4435)
Browse files Browse the repository at this point in the history
* Replaced google dashboard charts with Chart.js

* Changed chart size

* Typo [skip ci]

* fixes

* use random_int()

* removed duplicated code

* sonar-1

* sonar-2

* check for installed module

* update

* Update app/code/core/Mage/Adminhtml/Block/Dashboard.php

Co-authored-by: Colin Mollenhour <colin@mollenhour.com>

* copyright, ref MahoCommerce/maho@b4e66fc

* moved constants to correct class

* docs

* Update app/code/core/Mage/Reports/Helper/Data.php

---------

Co-authored-by: Colin Mollenhour <colin@mollenhour.com>
  • Loading branch information
sreichel and colinmollenhour authored Feb 28, 2025
1 parent cd7bf93 commit 6f59465
Show file tree
Hide file tree
Showing 14 changed files with 351 additions and 293 deletions.
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,15 @@
/app/etc/modules/Cm_RedisSession.xml
/lib/Credis

# flow.js library
/js/lib/uploader
# ChartJs library
/js/lib/chartjs

# TinyMCE library
/js/lib/tinymce

# flow.js library
/js/lib/uploader

# Add development environment setup files and README
# https://github.com/OpenMage/magento-lts/pull/1012
/dev/openmage/docker-magento
Expand Down
7 changes: 6 additions & 1 deletion app/code/core/Mage/Adminhtml/Block/Dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ class Mage_Adminhtml_Block_Dashboard extends Mage_Adminhtml_Block_Template

/**
* Location of the "Enable Chart" config param
*
* @deprecated
* @see Mage_Adminhtml_Helper_Dashboard_Data::XML_PATH_ENABLE_CHARTS
*/
public const XML_PATH_ENABLE_CHARTS = 'admin/dashboard/enable_charts';

Expand Down Expand Up @@ -60,7 +63,9 @@ protected function _prepareLayout()
$this->getLayout()->createBlock('adminhtml/dashboard_searches_top'),
);

if (Mage::getStoreConfig(self::XML_PATH_ENABLE_CHARTS)) {
/** @var Mage_Adminhtml_Helper_Dashboard_Data $helper */
$helper = Mage::helper('adminhtml/dashboard_data');
if ($helper->isChartEnabled()) {
$block = $this->getLayout()->createBlock('adminhtml/dashboard_diagrams');
} else {
$block = $this->getLayout()->createBlock('adminhtml/template')
Expand Down
Loading

0 comments on commit 6f59465

Please sign in to comment.