MS SQL Server Connectivity with D3.js/DC.js

2,768 views
Skip to first unread message

Piyush.D3.India

unread,
Sep 23, 2015, 5:23:51 AM9/23/15
to d3-js
Hello Friends,

I have to make a Dashboard in D3.js/DC.js using MS SQL Server . Is there any good internet resource or e-book that can
help me in understanding how to make a Visualization whose data is fetched from SQL Server.
I can make several kind of visualizations but I have no idea how to link it with SQL Server.

NOTE: Do not tell me about  how to connect MYSQL, As I m working strictly on MS SQL Server.

Thanks in Advance :) 

Regards
Piyush  

Curran

unread,
Sep 23, 2015, 12:34:21 PM9/23/15
to d3-js
Hi Piyush,

I would suggest trying to make a REST API that queries your database, and have D3 code connect to that API over HTTP. From the D3 code perspective, it would be just like loading a JSON file, but instead of fetching a file from disk, it would query your API instead. The API would need to be a server-side piece of code that executes some SQL query and returns the result to the browser in a format that is easy to parse in JavaScript (typically JSON or CSV). You should be able to call the REST API from your D3 code using the function d3.csv or d3.json. Perhaps it could return the entire table if it is small enough to fit in the browser, or perhaps the SQL query would need to do some filtering to make the data small enough to send to the browser.

Do you have any server side component already? Depending on the language used for the server side, it may be easy or hard to create a REST API that queries the database. Here's a StackOverflow thread about creating REST APIs for databases.

Maybe as a first experiment, before creating a REST API, you can try extracting the data from the database into a CSV file. Here's a thread that shows how to do this. Then your D3 code can load that CSV file. An easy way to maintain a service like this would be to have a script run periodically that extracts the data to a CSV file, but it would be better to make a REST API that queries the database on demand.

Best regards,
Curran

Joselie Castañeda

unread,
Nov 4, 2016, 4:19:13 AM11/4/16
to d3-js
Thanks Curran, this helped me a lot!

Phuoc Do

unread,
Nov 4, 2016, 8:22:10 PM11/4/16
to d3-js
I work at vida.io. We have support for d3.js and MS SQL. You can create a data source and connect to MS SQL. Then you can link your d3.js/dc.js visualizations to the dataset. The setup is fairly easy to do. We have a detailed blog post on BigQuery. Instead of BigQuery, you can select MS SQL as your data source type.


And video demo:


If you are inside a firewall, we can provide a dev build for you to run locally. Please send me an email:


Thanks,

Phuoc Do

Tito

unread,
Nov 7, 2016, 8:27:00 PM11/7/16
to d3-js


On Friday, November 4, 2016 at 1:19:13 AM UTC-7, Joselie Castañeda wrote:
Reply all
Reply to author
Forward
0 new messages