d3.js

“Cross origin requests” error when loading local file in chrome but in firefox. Why? [duplicate]

流过昼夜 提交于 2019-12-25 08:50:06
问题 This question already has answers here : Jquery load() only working in firefox? (2 answers) Read local XML with JS (5 answers) Closed 2 years ago . I was trying to load a local json file using d3.json method, but I am getting an error . Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https But if I load the same in mozilla firefox , it runs perfectly fine. My code is: d3.json("some_local_file.json", function(e, data) { if (e) console.warn(e

D3.js - what is selection.call() returning?

China☆狼群 提交于 2019-12-25 08:42:15
问题 I'm currently working on a force simulation. Here's the fiddle if you need it. This particular section is giving me a bit of trouble - I'm trying it for links and not nodes, where the situation is similar, so we can see the difference of working and non-working: function linkRender(selection) { selection .data(links) .enter().append("line") .attr("stroke-width",2) .attr("stroke","black") } let link = svg.selectAll("line").call(linkRender); Here, call() is supposed to return the selection,

NVD3 stacked bar chart option not working

此生再无相见时 提交于 2019-12-25 08:26:39
问题 I am trying to create bar chart using nvd3 data. Grouped option is working fine but when I select Stacked it gives following error. Uncaught TypeError: Cannot read property '1' of undefined(…) JSON format is as below. var test = [ { "key":"A", "values": [ {"x":"2016-11-24","y":34}, {"x":"2016-11-25","y":10} ] }, { "key":"B", "values": [ {"x":"2016-11-25","y":15} ] }, { "key":"C", "values": [ {"x":"2016-11-28","y":11} ] }, ] javascript code: var chart; nv.addGraph(function() { chart = nv

I am trying to inject a partial template in Angular that contains a graph

早过忘川 提交于 2019-12-25 08:26:23
问题 I am creating an Angular application in ASP.NET with partial templates. When I select the menu, and click "Employees", a controller calls a webservice and returns the correct JSON data, and I store it in $scope.message . I've displayed $scope.message on the screen, and everything works. However, I want to feed $scope.message as data source to a D3plus boxplot graph stored in a partial template called employees.html . It does not seem to be working. Perhaps I am making an obvious mistake and

D3.js Opacity filters partially working

安稳与你 提交于 2019-12-25 08:20:23
问题 I have a solid d3.js graph that works well for the most part. There are 4 node types: Agent,Customer,Phone,ID_Card There are checkboxes that handle the opacity of the nodes and links. If Agent and Customer are checked then the 2 nodes and all possible links between them are opaque. And rest of the graph has opacity(0) Also, there is a Search feature , which lets the user search through the graph with the below node attribute d.id A node for which the input ID matches , will stay opaque and

How to update selection with new data in D3?

做~自己de王妃 提交于 2019-12-25 08:15:04
问题 I'm trying to edit the data of created circles in D3. Below my code is pasted of me creating a lot of circles based on some data from graphData . Supposed I'd want to re-arrange my circles Y position with a new dataset, by transitioning them to their new destinations. How would perform this task? I've tried using attr .("cy", function(d){return yScale(parseFloat(d))} ) to update my Y-coordinates by adding data(graphData[i], function(d){return d;} ) with my new data, but this does not work.

Inverting SVG image mask

若如初见. 提交于 2019-12-25 08:01:10
问题 In my application, it is more convenient for me to use an image to mask SVG shapes rather than the other way round. (The desired multi-color overlays effects can be achieved either way.) The problem is, when I use a normal (grayscale) image as the mask, the result looks like a negative film. Is there an SVG attribute or clever JS/D3 trick that I can use to tell the browser to invert its masking protocol or am I stuck with converting the images myself (which may end up being less convenient

parsing dates using time in d3

社会主义新天地 提交于 2019-12-25 07:44:34
问题 How can I get something like this to work? Example date format: 6/20/2016 10:30:00 AM Example operation I want to perform: parseDate(data["Checkin"]).getMonth() + 1 Current parseDate function: var parseDate = d3.time.format("%m/%d/%Y %H:%M:%S %p").parse; I am getting a data.slice is not a function TypeError when calling a d3 graphing function after the following: var data = d3.csv("Sales Export Friendly 3-19-17.csv", function(data) { return { unit: data["Unit Booked"], date: parseDate(data[

How can I wrap long text labels with D3.js?

社会主义新天地 提交于 2019-12-25 07:37:53
问题 I have created a node-tree using D3 and would like to understand how to wrap texts that are too long. nodeUpdate.select("text") .text(function(d) { if(d.name == "root"){ return ""; } else { return d.name; } }) .style("font-family", "Verdana") .style("fill-opacity", 1); If d.name is too long I'd like it to fill several lines instead of one. I have found this http://bl.ocks.org/mbostock/7555321 but I do not seem to understand how this works, and I certainly don't understand how the "wrap"

D3 - Add a raw symbol

↘锁芯ラ 提交于 2019-12-25 07:30:13
问题 I have a D3 code. I want to add a svg symbol "as is"! to the D3 svg. I dont want to create the symbol dynamically using D3, I have the symbols already made from our designer and i want to use it as is! This is my jsfiddle: https://jsfiddle.net/omriman12/8786e8zq/1/ In the fiddle I have my d3 container pie_chart_wrapper and i want to add the symbol md_file to the d3 svg 回答1: Just add previous definded symbol to your SVG: svg.append("g") .attr("transform","translate(0,0)") .attr("class",