d3.CSV not working on windows server 2008 R2 which does not has Microsoft office installed.

79 views
Skip to first unread message

Chetan Singh

unread,
Aug 4, 2016, 2:29:07 PM8/4/16
to d3-js
Hi Team,
I am using d3.js in .NET website. It has html page where i am creating a tree view chart. I am getting data from CSV file. I facing below issues. I would be thankful if you could help me to fix it.

1. Before writing code in .NET IDE, i was using Notepad++. If read the file from CSV then it works only on FireFox browser not in IE and chrome.
2. To fix it i put my code in .NET IDE so that i can run it in IIS Express server (localhost). In .NET code also i am facing same issue even this time it does not work on FireFox .My system configurations
1. OS : Microsoft windows server 2008 R2
2. Does not has Microsoft office installed because it is server and as per my company policy i can not installed it.
3. When i debug the code then i notice that i am also get CSV data null, means that d3.csv() does not read CSV file. I also changed it to txt file but not able to work.

Thanks
Chetan

Sean McKenna

unread,
Aug 5, 2016, 12:58:01 PM8/5/16
to d3-js
Loading resources through javascript, like a CSV or JSON file, will often require you to run a web server to host the file. Running it locally will give you errors in the javascript console, but it is not always clear that this is the issue. This would explain why you can run the code in Firefox (which, by default, allows for this potential security issue) but not other browsers. If you start up a web server, such as python's simply http server, or npm's http-server, then you should see it working in all browsers.

Chetan Singh

unread,
Aug 5, 2016, 1:54:28 PM8/5/16
to d3...@googlegroups.com
Hello Sean,

Thanks for your mail.
I have deployed my application on IIS but still facing same problem. Do not know how to fix it.
If i deploy application on IIS then it does not work on Firefox as well.
Let me know if any one has the solution.

Thanks
Chetan

--
You received this message because you are subscribed to a topic in the Google Groups "d3-js" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/d3-js/UFRRxNVjeVs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to d3-js+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

steve...@talktalk.net

unread,
Aug 23, 2016, 12:57:56 PM8/23/16
to d3-js
This worked for me to connect to 2008 R2 server from aspx page:  Live example:  http://www.pmd3.co.uk/d3/LiveRisk.aspx
public string myJsVar;

    public string z_MyFunction()
    {
        string jsonCircles;
        DataTable yourTable= new DataTable();
        string conString = (ConfigurationManager.ConnectionStrings["yourConnectionString"].ConnectionString);


        using (SqlConnection _con = new SqlConnection(conString))
        using (SqlCommand _cmd = new SqlCommand("yourStoredProcedure", _con))
        {
            _cmd.CommandType = CommandType.StoredProcedure;

            SqlDataAdapter _dap = new SqlDataAdapter(_cmd);
            _dap.Fill(yourTable);

            DataSet dataSet = new DataSet("dataSet");
            dataSet.Namespace = "NetFrameWork";
            dataSet.Tables.Add(yourTable);

            dataSet.AcceptChanges();

            jsonCircles = JsonConvert.SerializeObject(yourTable, Formatting.Indented);
            return jsonCircles.ToString();

        }

    }



e.g. yourStoredProcedure example  Select * FROM yourDatabaseTable



 protected void Page_PreRender(object sender, EventArgs e)
    {
        myJsVar = z_MyFunction();
    }



Add this to ASPX page   var dataX =  <%= myJsVar %>; 
Reply all
Reply to author
Forward
0 new messages