24 lines
1.4 KiB
JavaScript
24 lines
1.4 KiB
JavaScript
d3.select('body').append('h1');
|
|
d3.select('h1').text('Hello World');
|
|
d3.select('h1').style('color', 'pink');
|
|
//d3.select('h1').attr('class', 'first-heading')
|
|
d3.select('h1').attr('id', 'first-heading')
|
|
d3.select('h1').classed("class-added", true)
|
|
// d3.select('h1').remove();
|
|
|
|
// d3.select('body').append('p');
|
|
// d3.select('p').text('Added First Paragraph');
|
|
// d3.select('p').style('color', 'red');
|
|
d3.select('body').append('p').text('Added First Paragraph with Method Chaning').style('color', 'red')
|
|
d3.select('body').append('div').text('outerdiv text here').style('border', '1px solid blue')
|
|
.append('div').text('Innerdiv text here').style('border', '1px solid green')
|
|
|
|
d3.select("body").append('p').text('First Message').text('Second Message')
|
|
|
|
d3.select('div').insert('div', 'div').text('inserted text')
|
|
|
|
d3.select('body').append('div').html('<a href="https://google.com">Click Here!</a>')
|
|
|
|
d3.select('body').append('div').classed("new-class", true).attr('id', 'new-id');
|
|
d3.select('.new-class').text('select element with class').style('color', 'aqua');
|
|
d3.select('#new-id').style("font-family", "sans-serif"); |