Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# ignores
Data Structure Using C/
index.js
readmecode.md
React_Sikhni_Hai_AaaJao_Sikha_doon.md
en/
readme.md
server.asm
4 changes: 0 additions & 4 deletions Data Structure Using C/readme.md

This file was deleted.

74 changes: 0 additions & 74 deletions Data Structure Using C/stack/stack.c

This file was deleted.

129 changes: 0 additions & 129 deletions React_Sikhni_Hai_AaaJao_Sikha_doon.md

This file was deleted.

60 changes: 60 additions & 0 deletions d3ex.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
chart = {
// Declare the chart dimensions and margins.
const width = 928;
const height = 500;
const marginTop = 30;
const marginRight = 0;
const marginBottom = 30;
const marginLeft = 40;

// Declare the x (horizontal position) scale.
const x = d3.scaleBand()
.domain(d3.groupSort(data, ([d]) => -d.frequency, (d) => d.letter)) // descending frequency
.range([marginLeft, width - marginRight])
.padding(0.1);

// Declare the y (vertical position) scale.
const y = d3.scaleLinear()
.domain([0, d3.max(data, (d) => d.frequency)])
.range([height - marginBottom, marginTop]);

// Create the SVG container.
const svg = d3.create("svg")
.attr("width", width)
.attr("height", height)
.attr("viewBox", [0, 0, width, height])
.attr("style", "max-width: 100%; height: auto;");

// Add a rect for each bar.
svg.append("g")
.attr("fill", "steelblue")
.selectAll()
.data(data)
.join("rect")
.attr("x", (d) => x(d.letter))
.attr("y", (d) => y(d.frequency))
.attr("height", (d) => y(0) - y(d.frequency))
.attr("width", x.bandwidth());

// Add the x-axis and label.
svg.append("g")
.attr("transform", `translate(0,${height - marginBottom})`)
.call(d3.axisBottom(x).tickSizeOuter(0));

// Add the y-axis and label, and remove the domain line.
svg.append("g")
.attr("transform", `translate(${marginLeft},0)`)
.call(d3.axisLeft(y).tickFormat((y) => (y * 100).toFixed()))
.call(g => g.select(".domain").remove())
.call(g => g.append("text")
.attr("x", -marginLeft)
.attr("y", 10)
.attr("fill", "currentColor")
.attr("text-anchor", "start")
.text("↑ Frequency (%)"));

// Return the SVG element.
return svg.node();
}

console.log("Hello");
7 changes: 0 additions & 7 deletions en/readme.md

This file was deleted.

1 change: 0 additions & 1 deletion index.js

This file was deleted.

5 changes: 0 additions & 5 deletions readme.md

This file was deleted.

1 change: 0 additions & 1 deletion readmecode.md

This file was deleted.

Loading