Not sure what you mean by :
I want to create 2 bar charts side by side from this data.
If you want to duplicate the same chart, you can use SVG 'use' element :
If your question is about positioning two charts next to each other, wrap your charts in containers, and translate the second container next to the first :
var container1 = svg.append('g') .attr('id','container1'); var container2 = svg.append('g') .attr('id', 'container2'); container1.selectAll('.actuel') .data(dataset)... //Create the chart1 here container2.selectAll('.actuel') .data(dataset)... //Create the chart2 here container2.attr('transform','translate('+ svgWidth/2 +',0)'); //To move the g container to the right.
where svgWidth is the width you gave to your svg, assuming your charts use half of the width for themselves.
Hope that answers your question !
- Two bar charts from same data object using D3.js
- Can d3.js draw two scatterplots on the same graph using data from the same source?
- Constructing multiple bar chart by using only two columns from .csv file
- Using .filter() in d3.js to return data from corresponding x-axis point on multiple charts
- Using data from two separate geoJSON files in D3.js map visualization
- changing height of bar charts from new data
- d3.js - multiple charts on same page from different parts of same JSON object
- Creating Multiplie Pie Charts in a same page using d3 with JSON data
- How to access object properties in a JSON file using literals obtained from the same file
- Accessing values from different levels of a nested object within the same append instance using D3.js
- Unable to create a bar chart from json data using d3.js
- Importing data from two csv files using d3js
- Plotting a line using d3 and an JSON data object passed from rails
- d3JS v5 specifying domains from nested data for grouped bar charts
- Display Bar Chart for Last week, Last Month, and Last Year Data from JSON using D3.js
- How to Create/Show Multiple Iterations of Charts with the same data in One Area with Buttons using D3.js
- how to plot data from JSON object on .svg file using D3.js
- Importing data from .csv using d3.js
- Getting data for d3 from ArangoDB using AQL (or arangojs)
- Get data from rest service using D3
- dc.js add class to data points in multiple charts based on criteria from first chart
- How to update elements of an HTML that the elements are created using data from a CSV file?
- Data for sunburst charts with d3.hierarchy using D3js v4
- Create data visualizations using Express and get data from a PostgreSQL database
- Plotting Bar Chart from MySQL Database using D3.js
- reading nodes and edges from two distinct csv files using Force Layout
- Mouseover event on two charts at the same time d3.js
- D3 linegraph using JSON data from API
- Make two pie charts with the same d3js code
More Query from same tag
- Append multiple 'text' elements in d3
- D3 v5 working with Year only in timeParse
- d3js display arrow at the end of each axis
- In D3 Arrow is not calling based on the condition
- d3 adding html links to a column of data in a table
- d3.js - Row click event?
- D3 won't append elements after external JSON is loaded
- Arranging graphs on one screen
- Force Layout - Labelling and pinning down the nodes
- Does D3.js conicConformal projection support the same clipping/trimming options as Matlab?
- How to load more data in NVD3's lineWithFocusChart when the viewfinder boundary intersects the right or left margin in AngularJS?
- d3 with Highchart Jasper Export Issue using Custom Visualization Component(CVC)
- arrays and nodes mapping in d3 force
- d3 unable to append full data after filtering
- Reshape data for D3 stacked bar chart
- How to adjust node size based on value in diagonalNetwork of networkD3
- d3 zoom: prevent page zoom when using a touchscreen
- In d3 how can you format a date with single digits for month and year if they are under t0?
- How to add delay on animation by calculating `index` value in d3.js?
- How to add some padding between a path and text on it?
- Multiple Y axes in nvd3 scatter graph
- d3 line does not draw
- Beeswarm plot with force - add links to nodes
- Adding elements to hierarchy for circle packing colours
- D3 V4 assigning a listener to d3.brushX when the element is first rendered
- d3 tracking overlay multiple lines
- Adding a tooltip to a dynamically-created SVG element
- Using d3.selection.classed() with class value from datum
- d3 sunburst without strict parent-child relationships
- d3 Links Not Properly Hiding