D3, Node.js and Express.

478 views
Skip to first unread message

Simon Breton

unread,
May 15, 2016, 7:18:18 PM5/15/16
to d3-js
Hi all,

It's my first post on this group. In found it through the book Interactive Data Visualisation for the web. 

I'm trying to build a web app with node.js and D3. My final goal is visualise data from a dynamoDB data base. 

Here is my problem :

I've have a very simple array of data : var dataArray = [ 5, 10, 15 ]

When I defining it in my app.js as a local variable using express like this "app.locals.dataArray = [ 5, 10, 15 ]" it's working perfectly in my default.ejs file.

However I can't use it into my d3 code...

Hope someone can help me.

thanks !

Tito

unread,
May 16, 2016, 12:35:44 AM5/16/16
to d3-js
check this out while I build one for dynamodb

Simon Breton

unread,
May 16, 2016, 11:22:23 AM5/16/16
to d3-js
Thanks a lot Tito. But I've a question : dynamodb is not supposed to be a nosql database ?

Tito

unread,
May 16, 2016, 12:33:45 PM5/16/16
to d3-js
it is a nosql database which you can query.

Simon Breton

unread,
May 16, 2016, 12:41:36 PM5/16/16
to d3-js
hum ok. Sorry I'm really a beginner. 

so where do I found these info :

'host' : 'your.mysql.ip',
'port' : '3306',
'user' : 'your.mysql.user',
'password' : 'your.mysql.user.password',
'database' : 'd3nodeexpressmysql'

and how do I "Run sample mysql script in your mysql server" ? 

Thanks !

Tito

unread,
May 16, 2016, 12:50:04 PM5/16/16
to d3-js
do you currently have a dynamoDB instance on aws or locally? what is your skill level in dynamoDB. I think you can use

    AWS = require('aws-sdk');
configure things to populate your table and query it to display the map.
you will have to of course change that section to fit dynamoDB.

Any idea how to create a table and populate it in dynamoDB?

Simon Breton

unread,
May 16, 2016, 12:54:47 PM5/16/16
to d3-js
I've my dynamoDB instance on aws and I would say I have a skill level of 0 :)

I've created my table and I know I to make query and scan it with node.js but that's all. I'm maybe asking for too much but I don't where I should
look for to learn the basics... 

I've read stuff about "the map" but I don't understand anything !

Tito

unread,
May 16, 2016, 1:14:30 PM5/16/16
to d3-js
ok give me a few minutes, I think I almost have it. I am new to dynamoDB myself. until then read also the following.


I Think I should have something real soon. hang on!

Simon Breton

unread,
May 16, 2016, 1:16:21 PM5/16/16
to d3-js
haha thanks a lot. About the Getting started with NodeJs, I've already done everything they say here. 

Tito

unread,
May 16, 2016, 1:47:49 PM5/16/16
to d3-js
I am having hard time creating a table with 4 key values in dynamoDB. help me with that and I will finish it up for you

Simon Breton

unread,
May 16, 2016, 1:56:45 PM5/16/16
to d3-js
I don't know if I can help you. To create a table with 4 key values, I just update my datatable with a json file formatted in the most simple way :

{
        "Item1": value,
        "Item2": "value",
        "Item3": "value",
        "Item4": value
    }

The first Item (Item1) should be identified with a unique ID and DynamoDB will automatically create the other column. 

It's kind of messy for me so I don't know if I'm helpful with this !

Thanks.

Tito

unread,
May 16, 2016, 2:27:53 PM5/16/16
to d3-js
ah nice! how can I make Item1 dynamically generated value?

Simon Breton

unread,
May 16, 2016, 2:39:23 PM5/16/16
to d3-js
Good question and I don't know. Right now all my data are in a spreadsheet so I can easily generate unique ID. Of course I won't do this in the future but I haven't yet figure out how to retrieve my data properly and the way I want. 

Tito

unread,
May 16, 2016, 2:54:40 PM5/16/16
to d3-js
ok no worries I figured out a way. please post sample data here. and what kind of chart you want. almost there

Tito

unread,
May 16, 2016, 7:28:29 PM5/16/16
to d3-js
ok here it is 


you gonna have to dig in a bit more to configure things out though.
Reply all
Reply to author
Forward
0 new messages