score:3
Accepted answer
use this function to locate the dots in the column names and keep only the last part of any name that has a dot:
function removedot(d){
object.keys(d).foreach(function(origprop) {
var nodot = origprop.split(".")[1];
if (nodot != undefined) {
d[nodot] = d[origprop];
delete d[origprop];
}
});
return d;
};
to use this function, define an accessor like this:
d3.tsv(file, removedot, function(error, data) {
//all your code here
});
note: keep in mind that only d3.csv
and d3.tsv
accept accessors.
Source: stackoverflow.com
Related Query
- d3 modifying column names
- d3 seems to assume I know the column names of a csv?
- Trying to find a way to get the row and column names of csv in html/js by using d3 , any other ways?
- d3 reading csv/tsv files if column names are numbers?
- D3: How do I parse a CSV string into an object where keys are column names and values are arrays of data?
- right way to modify d3.csv to lower case column names
- The column names of my CSV files are years in yyyy format. How do I refer to these columns using "." operator in d.columnName?
- Split a cell values into new column names
- How to use D3 selectAll with multiple class names
- How can I position rotated x-axis labels on column chart using nvd3?
- Modifying SVG path opacity and it's marker
- Maximum width for column in bar chart
- Add names of the states to a map in d3.js
- Bootstrap get width of div column in pixels
- Read csv data with D3.csv, each column in separate array
- How to show the total per column in tooltip title with c3.js?
- D3 heatmap without explicitly storing row and column
- Selecting d3 data subset based on column
- modifying the d3 force-directed graph example
- Find max value in CSV column using d3.max
- How to use ordinal scale in d3 to return month names
- d3 how to make single stacked column chart
- Convert data types in d3.js without prior knowledge of property names (detect if a string contains only digits)
- Modifying an SVG in HTML using d3
- modifying d3's force layout "annealling" schedule
- dc.js - how to get the average of a column in data set
- D3 Linking nodes based on names rather than index
- Change node colors in d3 Sankey Diagram based on additional column in data
- D3 - ordinal scale labels with same names
- Handling Different Child Object Names Recursively
More Query from same tag
- d3.js v4 stacked bar tooltip / hover (using modified d3-tip) offset issue
- Passing an object property to D3 'enter()'
- scipy dendrogram to json for d3.js tree visualisation
- Parameters needed for d3.mouse()
- Sankey diagram transition
- transitionDuration function does not exist in nvd3.js
- Converting networkx graph to flare json
- Why piecharts begin drawing from different angles in D3?
- Rickshaw AJAX with two endpoints
- Once I put a function into defer() in D3, the data structure inside console.log changed in other function
- Set Gravity center using D3.js Version 4
- On making chart responsive the x,y axis line disappears
- How to bind d3 generated HTML elements to scope?
- d3 v5 tree zoom, drag, and reset
- Highlight important points on jsD3 area graphic
- given 1 chart in d3 fed by 1 file + want to draw X charts given an array of X files + d3
- d3: why is variable set inside d3.json not accesible outside?
- Shading polygons with d3
- d3js - adding a speech-bubble like tooltip?
- Using array of strings for axis but last one is missing
- js d3 chart with timescale
- How can I clone and modify an existing group into a selection?
- How to create proportionally spaced horizontal grid lines?
- Select the class of an element on mouseover D3js
- Synchronize brushes across different objects
- D3 Scatter Plot With Nested Array
- sending json to d3js graph
- Looping a function and tracking if there are 4+ identical values in a row
- What does the "System" category of records mean in Chrome Timeline profiling tool?
- How to create a bar chart made up of very small squares