Debug Logs

Overview #

SmartChart provides two debugging methods: dashboard-level logs and graph-level log() function. Compared to opening the browser F12 console, SmartChart’s built-in logging system is better suited for large-screen development scenarios — you can see log output and graphic sequence numbers directly on the page for quick problem identification.


Enable Log Display in Dashboard #

Click the log toggle in the dashboard top menu to switch log display status:

Enable Dashboard Logs

Once enabled, logs appear in the bottom-right corner of the page when refreshing or executing graphics, with the corresponding error graphic’s sequence number labeled for quick identification:

Dashboard Log Display


Using log() to Print Logs in Graphics #

SmartChart provides a dedicated log() function, similar to Python’s print (renamed from print to log in newer versions).

// Print variable values
log(dataset)

// Print ECharts event parameters (view data structure on mouse hover/click)
myChart__name__.on('mouseover', function(params) {
    log(params)   // params structure visible in both editor and page bottom-right
})

// Print general info
log('Current city: ' + ds_param('city'))

Using log in Graphics


Smart Toggle Mechanism of log() #

The log() function is linked to the dashboard’s log toggle:

  • When dashboard logs are enabled: log() outputs to the page’s bottom-right corner and browser console
  • When dashboard logs are disabled: log() prints nothing, no performance impact on production

This means you can safely keep log() statements in your code — just turn off the dashboard log toggle after going live; no need to clean up debug code.


Real-time Coordinate Display #

The logging feature can also display real-time mouse drag coordinates, which is very useful for precise positioning of graphic elements:

Real-time Coordinates


Debugging Recommendations #

Scenario Recommended Method
View dataset structure log(dataset)
View ECharts event parameters log(params) in event callbacks
View current global parameters log(filter_param)
Locate error graphics Enable dashboard logs; log area shows error graphic sequence numbers
View element coordinates Enable dashboard logs; coordinates display in real-time during drag
Before going live Turn off dashboard log toggle — no code changes needed