score:44
Accepted answer
the problem is that you're using the same selector, svg.selectall(".dot")
, for each dataset .data(tsv1)
and .data(tsv2)
.
d3 thinks that the 2nd set is supposed to replace the first. you can fix it by assigning a unique class to each type of dot.
svg.selectall(".blue.dot")// select specifically blue dots
.data(tsv1)
.enter().append("circle")
.attr("class", "blue dot")// assign two classes
...
svg.selectall(".orange.dot")
.data(tsv2)
.enter().append("circle")
.attr("class", "orange dot")
...
Source: stackoverflow.com
Related Query
- D3.js Plotting Multiple Data Sets from Separate Files
- Importing data from multiple csv files in D3
- D3.js join data from multiple csv files
- Using data from two separate geoJSON files in D3.js map visualization
- Adding multiple sets of data to C3 graph stops either from showing up
- Project data from a single geojson when multiple geojson files are present
- heatmap.js - plotting multiple data points from .csv
- dc.js add class to data points in multiple charts based on criteria from first chart
- Separate data from datahash
- d3: Coloring Multiple Lines from Nested Data
- D3: Loading multiple csv data files in a folder
- Plotly/D3 – Reading data from CSV into separate traces
- Create map that combines data from two files with common column - but data doesn't match one to one
- Importing data from excel files in D3 js
- Using .filter() in d3.js to return data from corresponding x-axis point on multiple charts
- plotting data points on waves from dynamically generated data using d3.js
- Enter() statement with a function from one data array to multiple arrays? (Adding multiple Gradient Paths)
- Generating multiple DOM elements from a single data point with D3.js
- D3.js grouped bar chart plotting data multiple times
- update d3 pack layout from multiple json files
- What is the best way to combine multiple csv files data input using d3.csv in d3.json ?
- D3 Plotting Rectangles from Coordinate data
- plotting data to a line graph using 2 data sets
- D3.js: Loading multiple networks from JSON files w/ Force Layout
- D3JS Plotting Line Graph From Array Data (Data is undefined error)
- D3 getting data from multiple column CSV
- D3 How to filter data from multiple datasets
- Get d3 Extent (Min/Max) from multiple line data array
- Multiple Lines from Multiple Data D3js
- d3 multiple circles per tick from grouped data array
More Query from same tag
- 1d array into binary tree
- Display non-ASCII characters from CSV file retrieved with d3.csv
- d3 - trigger mouseover event
- Make axis ticks strings in d3
- Placing d3.js svg elements inline in HTML
- D3 Transition Path Left And Shift Up/Down Simultaneously
- Add mouse hover containing specific data to d3.js tree map
- D3.js not rendered properly on Mozilla Firefox
- Should I filtering my data for d3 in SQL or JS
- How to set a d3Plus Timeline with only Certain years?
- TopoJSON - adding properties to a topoJSON file
- Dart D3 line using Package JS
- How perform mouseover event on pair of items in d3?
- disable scroll for a div with SVG
- Angular 2 D3 Event, Change Detection and Context
- How to zoom around an svg
- object HTMLImageElement cannot be "saved as" image in Internet Explorer
- Flatten an Object hierarchy created with d3.js nesting
- How to get the axis ticks of Plotly's scatter plot to be shown in Latex using Python? --- [Python, Plotly, Latex Representation]
- How to embed diagrams made using d3.js(javascript) into sinatra web application?
- Fill an object with indexes from another object
- D3 map displaying country name
- US Zipcode TOPOJson for D3
- SVG text is poor quality?
- Is it possible to determine if a GeoJSON point is inside a GeoJSON polygon using JavasScript?
- Install and run node module - step by step (EventDrops)
- Swapping event handlers between DOM elements d3
- How to programmatically open ngbootstrap popover for a d3 element?
- this.setAttribute is not a function when using D3's .attr method
- How to do smooth transition for map reprojection in d3 js