Problems using Hype Data Magic with Fetch (CORS)

Hi
Thanks for the answer.

I have used DataMagic to get the data from google sheets and it works fine. But when I try to use the data I can not get it to work. Maybe it's a simple error from my side (I'm not a programmer).
I have used the Chart.js library with the help of Mark Hunte's good explanation here:Using Chart.js within Hype

And the great DataMagic but I cant get my head around it.
Here is two examples of what I'm trying to do. One is with a chart that uses data that you can enter in the textfields and that works as I should. But when I try to get the data from the DataMagic I get the error "Error in undefined: TypeError: undefined is not an object (evaluating 'monthValueValue.trim')".

Any ideas?

Sorry that the comments in the code is in Swedish, I can change that if needed.

Skapa diagram data.zip (34.6 KB)
Skapa diagram google data.zip (34.3 KB)

Skapa diagram google data - max.hype.zip (35,9 KB)
A really simple example using your Hype Function. You could also use a Hype Data Magic handler.

1 Like

Hi Max!
Sorry for the late response but I have had some Christmas vacation.
Thank's for the elegant solution!

Rickard

This is the same problem and is not related to Hype Data Magic. It is a bout the security implementations around Fetch and CORS.

Yes, I found that answer when I started searching the forum.
So I started to test it on a website. I exported the file as an OAM and tried it on a test site in Wordpress.
But I can't get it to work. I also tried to make an OAM file directly from your example file "HypeDataMagic-Example-Branches-and-Sources". But with no luck.
With your file I don't get any error report in the console.
With the chart-file I get "Unhandled Promise Rejection: ReferenceError: Can't find variable: HypeDataParser".
Is it not possible to use the AOM-file with the HypeDataMagic?

Here is the site with the test: https://studioax.se

WordPress is another can of worms as that plugin doesn’t cue the head HTML content. So, hype data magic will not load. Try using it in iframe mode.

1 Like