New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to add dynamic charts using Cedar #81
Comments
For the resources problem , take a look to this PR . A little explanation : Cedar was not loading then the following code will crash : var chart = new Cedar({
//Tipo de gráfico
"type": "bar",
//Dataset
"dataset": {
"url":serviceUrl,
//En esta query lo que hacemos es un conteo de las ciudades que hay en cada POP_CLASS
"query": {
"groupByFieldsForStatistics": xField,
"outStatistics": [{
"statisticType": "count",
"onStatisticField": "OBJECTID",
"outStatisticFieldName": "count_SUM"
}]
},
//En mappings definimos que representamos: En X cada POP_CLASS y en Y el conteo de las ciudades en cada POP_CLASS
"mappings":{
"x": {"field":xField,"label":"Rangos de población"},
"y": {"field":"count_SUM","label":"Número de ciudades"},
"sort": "count_SUM DESC"
}
},
//En tooltip definimos la ventana emergente al pasar el ratón por encima
"tooltip": {
"id": "tooltip-url",
"title": toolTipTitle,
"content": "{count_SUM} Ciudades"
}
});
//Mostramos el gráfico
chart.show({
elementId: "#chart",
autolabels: true
}); |
Hi @hhkaos, There are a number of ways to do what you're trying to do.
(note: I tried including Cedar in any number of I've tried to implement this last strategy on a fork of your repo. Take a look at the last two commits here: Here are the changes and some explanations from the above commits: index.html: main-config.js:
custom-scripts.js: Gruntfile.js:
in the
then in the copy section (around line 159), you'll need to copy over
And revert the added copy-over of Theoretically, if you were to require Cedar from within some already-being-built module, the explicit |
Thank you very very much @asizer !!
I still have problems understanding how the dojoConfig actually works... hehe. I really appreciate you help a lot. By the way I made another customization, I added Google Analytics to track some events as you can see here. I'm working on a session to encourage our partners to customize the storymaps. This session is called "Demystifying how to customize storymaps" and it will take place inside the developer track during our User Conference tomorrow. Thank you very much for your help! |
I would like to add some dynamic charts using Cedar to my storymap, something like this:
So the first approach I'm trying is adding this simple Cedar example to the storymap.
As you would notice everything works in development environment (using
grunt server
and opening localhost:8080/src/?appid=d2134b4665df4fdea6077a9255315484), you just need to click the second bullet "Población de Madrid" to check it. But after runninggrunt
the deployed app doesn't. It is because I'm not adding the libraries properly as you can notice in the console (you see the problem opening this deployment).I tried to follow all the instructions @ssylvia gave in this talk, so what I did is:
Step 1) I added a DOM element to the storymap item using the WYSIWYG builder
Step 2) Then I added the libraries directly to the
src/index.html
(this is by my own xD)Step 3) And finally I subscribed to the
story-loaded-map
event in thesrc/app/custom-scripts.js
And as I previously said, it works in development but it doesn't in production because there is no
lib-app
folder inside deploy, so I need some help understanding how should I include this dependencies inside the built.By the way, I have also tried reading the Developer Guide inside the README but I didn't find anything about this.
If you could help me here you would make me very very happy 💃 (hehe)
Thanks in advance!,
Raul
The text was updated successfully, but these errors were encountered: