0

When I use PHP 8.1, my RGraph chart does not work, the following error notice appeared:

uncaught referenceError: RGraph is not defined

I use the simple code as presented in the example on rgraph.net:

new RGraph.Bar{(
id: "cvs",
data: data,
.
.
.
)}.grow()

even if I use:

var bar = new RGraph.Bar{( ......)}

it still has the same error notice.

I hope this problem can be solved by define the RGraph, but it is not constant.

  • 2
    RGraph is JS, so that wouldn't be affected by your PHP version. Those are completely different languages that runs in completely different environments (JS in the client and PHP on the server). It could be a side effect of some other issue, like your PHP now generates some broken output, causing the front end code not to load the library or something (just a wild guess). You need to do some proper debugging to narrow the issue down. – M. Eriksson Aug 12 '23 at 08:05
  • 1
    I'll add that this page: https://www.rgraph.net/install/starting.html#implementing-a-basic-chart gives you basic HTML that#'s necessary to create a basic chart. Again, this has nothing to do ith PHP. Integration with PHP is covered more on this page: https://www.rgraph.net/install/integration.html – Richard Aug 12 '23 at 14:18
  • It is solved, the problem comes from the variable in the condition to include the RGgaph js package, it is needed to defined with null operator again. Otherwise, the Rgraph js package cannot be included. Thanks. – Robert Liu Aug 14 '23 at 15:09

0 Answers0