Published
Edited
Sep 13, 2018
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
a=9
Insert cell
b=7
Insert cell
c=a+b
Insert cell
Insert cell
import {canvas} from "@popotojs/connected-colored-particles-iii"
Insert cell
Insert cell
Insert cell
svg`

<svg>
<text y=50>
Hello Georgia! dan,mdwanm,dwa
</text>
</svg>
`
Insert cell
Insert cell
svg`

<svg>
<rect width=120 height=50 />
</svg>
`
Insert cell
svg`

<svg>
<rect width=100 height=30 />
<rect width=150 height=30 y=60 />
</svg>
`
Insert cell
Insert cell
{
return svg`

<svg>
<rect width=100 height=30 />
<rect width=170 height=30 y=40 />
</svg>
`
}
Insert cell
Insert cell
{
let width1 = 100;
let width2 = 100;
let height = 30;
let y = 40;
return svg`

<svg>
<rect width=${width1} height=${height} />
<rect width=${width2} height=${height} y=${y} />
</svg>
`
}
Insert cell
Insert cell
md`მართკუთხედები მონაცემებით`
Insert cell
{
var data = [
{
value:100
},{
value:180
},{
value:180
}
]
let height = 30;
let y = 40;

return svg`

<svg>
${data.map((d,i)=>{
return `<rect width=${d.value} height=${height} y=${y*i} />`
})}
</svg>
`
}
Insert cell
Insert cell
Insert cell
testData = [1,4,5]
Insert cell
Insert cell
testData.map(d=>d+1)
Insert cell
testData.map(d=> d*d*d*d)
Insert cell
testData.map( (d,i) => `გამარჯობა მონაცემო ${d}, ჩემი ინდექსია ${i}`)
Insert cell
Insert cell
testData.map(d=> {
return {value:d}
})
Insert cell
Insert cell
Insert cell
{
var data = [
{
key:'sveti1',
value:100
},
{
key:'sveti2',
value:200
}
]
let height = 30;
let y = 40;

return svg`

<svg>
${data.map((d,i)=>{
return `
<rect y=${y*i} x=50 width=${d.value} height=${height} />
<text y=${y*i+20}>${d.key}</text>
`
})}
</svg>
`
}
Insert cell
Insert cell
{
var data = [
{
key:'text1',
value:100
},
{
key:'text2',
value:200
}
]
let height = 30;
let y = 40;
return svg`
<svg>
${data.map((d,i)=>{
return `
<rect fill="orange" y=${y*i} x=50 width=${d.value} height=${height} />
<text fill="gray" y=${y*i+20}>${d.key}</text>
<text fill="gray" y=${y*i+20} x=${d.value+55}>${d.value} </text>
`
})}
</svg>
`
}
Insert cell
Insert cell
{
var data = [
{
key:'text1',
value:110
},
{
key:'text2',
value:200
},
{
key:'text2',
value:200
},
{
key:'text2',
value:200
}
]
let svgHeight = 200;
let barsHeight = svgHeight/data.length;
let y = 40;
let margin = 5;
return svg`
<svg height=${svgHeight} >
${data.map((d,i)=>{
return `
<rect fill="orange" y=${barsHeight*i} x=50 width=${d.value} height=${barsHeight-margin} />
<text fill="#635F5D" y=${barsHeight*(i+0.5)}>${d.key}</text>
<text fill="#635F5D" y=${barsHeight*(i+0.5)} x=${d.value+55}>${d.value}</text>
`
})}
</svg>
`
}
Insert cell
Insert cell
{
var data = [
{
key:'text1',
value:130
},
{
key:'text2',
value:200
},
{
key:'text2',
value:200
}
]
let xbar = 60

let svgHeight = 200;
let barsHeight = svgHeight/data.length;
let y = 40;
let margin = 5;
var svgWidth = 700;
var max = d3.max(data,d=>d.value)
var barScale = d3.scaleLinear().domain([0,max]).range([0,svgWidth-100-xbar]);
return svg`
<svg height=${svgHeight} width=${svgWidth} >
${data.map((d,i)=>{
return `
<rect fill="orange" y=${barsHeight*i}
x=${xbar}
width=${barScale(d.value)}
height=${barsHeight-margin} />
<text fill="#635F5D" y=${barsHeight*(i+0.5)}>${d.key}</text>
<text fill="#635F5D" y=${barsHeight*(i+0.5)} x=${barScale(d.value)+xbar+5}>${d.value}</text>
`
})}
</svg>
`
}
Insert cell
Insert cell
Insert cell
import {load} from "@bumbeishvili/fetcher"
Insert cell
d3 = require('d3')
Insert cell
Insert cell
Insert cell
data = load(sheetUrl)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
data
Insert cell
Insert cell
Insert cell
data.length
Insert cell
Insert cell
ემიგრაციაში_წასულები = data.filter(d=>d['გარდაცვალების ადგილი/პირობები']=='ემიგრაცია')
Insert cell
Insert cell
Insert cell
// უპასუხეთ აქ
data.filter(d=>d['განათლების მიღების ადგილი']=='რუსეთი')
Insert cell
Insert cell
// უპასუხეთ აქ
data.filter(d=>d['პროფესია']=='ჟურნალისტი').length/data.length*100
Insert cell
Insert cell
// უპასუხეთ აქ
data.filter(d=>d['მხარე']=='აფხაზეთი').length/data.length*100
Insert cell
Insert cell
Insert cell
ეროვნებით_დაჯგუფებულები = d3.nest()
.key(d=>d['ეროვნება'])
.entries(data)
Insert cell
ეროვნებები = d3.nest()
.key(d=>d['ეროვნება'])
.rollup(values=>values.length)
.entries(data)
.sort((a,b)=>a.value<b.value?1:-1)
Insert cell
Insert cell
Insert cell
// უპასუხეთ აქ
წოდებები = d3.nest()
.key(d=>d['ყოფილი წოდება'])
.rollup(values=>values.length)
.entries(data)
.sort((a,b)=>a.value<b.value?1:-1)
Insert cell
Insert cell
Insert cell
// უპასუხეთ აქ
სოციალური_პროფილები = d3.nest()
.key(d=>d['სოცილური პროფილი'])
.rollup(values=>values.length)
.entries(data)
.sort((a,b)=>a.value<b.value?1:-1)
Insert cell
Insert cell
Insert cell
// უპასუხეთ აქ
// უპასუხეთ აქ
განათლება = d3.nest()
.key(d=>d['განათლება'])
.rollup(values=>values.length)
.entries(data)
.sort((a,b)=>a.value<b.value?1:-1)
Insert cell
Insert cell
Insert cell
// უპასუხეთ აქ
// უპასუხეთ აქ
განათლების_მიღების_ადგილი = d3.nest()
.key(d=>d['განათლების მიღების ადგილი'])
.rollup(values=>values.length)
.entries(data)
.sort((a,b)=>a.value<b.value?1:-1)
Insert cell
Insert cell
Insert cell
// უპასუხეთ აქ
// უპასუხეთ აქ
// უპასუხეთ აქ
პროფესია = d3.nest()
.key(d=>d['პროფესია'])
.rollup(values=>values.length)
.entries(data)
.sort((a,b)=>a.value<b.value?1:-1)
Insert cell
Insert cell
Insert cell
// უპასუხეთ აქ
მხარე = d3.nest()
.key(d=>d['მხარე'])
.rollup(values=>values.length)
.entries(data)
.sort((a,b)=>a.value<b.value?1:-1)
Insert cell
Insert cell
Insert cell
Insert cell
// უპასუხეთ აქ
პარტიები = d3.nest()
.key(d=>d['პარტია'])
.rollup(values=>values.length)
.entries(data)
.sort((a,b)=>a.value<b.value?1:-1)
Insert cell
Insert cell
Insert cell
// უპასუხეთ აქ
პირობები = d3.nest()
.key(d=>d['გარდაცვალების ადგილი/პირობები'])
.rollup(values=>values.length)
.entries(data)
.sort((a,b)=>a.value<b.value?1:-1)
Insert cell
Insert cell
Insert cell
Insert cell
parseTime = d3.timeParse('%Y.%m.%d')
Insert cell
exampleDate = '1869.01.01'
Insert cell
parseTime(exampleDate)
Insert cell
Insert cell
dataWithDates = data.map(d=>{
return Object.assign({},d,{
date:parseTime(d['დაბადები წელი']),
})
})
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
dataWithAges = dataWithDates.map(d=>{
if(d.date){
return Object.assign({},d,{
age:calculateAge(parliamentDate,d.date)
})
}
return Object.assign({},d)
})
Insert cell
// უპასუხეთ აქ
d3.mean(dataWithAges,d=>d.age)
Insert cell
Insert cell
// უპასუხეთ აქ

d3.max(dataWithAges,d=>d.age)
Insert cell
Insert cell
// უპასუხეთ აქ
d3.min(dataWithAges,d=>d.age)
Insert cell
Insert cell
// უპასუხეთ აქ
წლები = d3.nest()
.key(d=>d['age'])
.rollup(values=>values.length)
.entries(dataWithAges)
.sort((a,b)=>a.key<b.key?1:-1)
.filter(d=>d.key!="undefined")
Insert cell
Insert cell
Insert cell
Insert cell
// უპასუხეთ აქ
ეროვნებები_პროცენტულობა = d3.nest()
.key(d=>d['ეროვნება'])
.rollup(values=>Math.round(values.length/data.length*100))
.entries(data)
.sort((a,b)=>a.value<b.value?1:-1)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
getZodiac('1992.12.26')
Insert cell
function getZodiac(date){
let month = date.split('.')[1]
let day = date.split('.')[2]

if ((month == 12 && day >= 22 && day <= 31) || (month == 1 && day >= 1 && day <= 19))
return ("თხის რქა");
else if ((month == 1 && day >= 20 && day <= 31) || (month == 2 && day >= 1 && day <= 17))
return ("მერწყული");
else if ((month == 2 && day >= 18 && day <= 29) || (month == 3 && day >= 1 && day <= 19))
return ("თევზები");
else if ((month == 3 && day >= 20 && day <= 31) || (month == 4 && day >= 1 && day <= 19))
return ("ვერძი");
else if ((month == 4 && day >= 20 && day <= 30) || (month == 5 && day >= 1 && day <= 20))
return ("კურო");
else if ((month == 5 && day >= 21 && day <= 31) || (month == 6 && day >= 1 && day <= 20))
return ("ტყუპები");
else if ((month == 6 && day >= 21 && day <= 30) || (month == 7 && day >= 1 && day <= 22))
return ("კირჩხიბი");
else if ((month == 7 && day >= 23 && day <= 31) || (month == 8 && day >= 1 && day <= 22))
return ("ლომი");
else if ((month == 8 && day >= 23 && day <= 31) || (month == 9 && day >= 1 && day <= 22))
return ("ქალწული");
else if ((month == 9 && day >= 23 && day <= 30) || (month == 10 && day >= 1 && day <= 22))
return ("სასწორი");
else if ((month == 10 && day >= 23 && day <= 31) || (month == 11 && day >= 1 && day <= 21))
return ("მორიელი");
else if ((month == 11 && day >= 22 && day <= 30) || (month == 12 && day >= 1 && day <= 21))
return ("მშვილდოსანი");
else
return ("Not Applicable");
}
Insert cell
// უპასუხეთ აქ
// უპასუხეთ აქ
ასტროლოგია = d3.nest()
.key(d=>getZodiac(d['დაბადები წელი']))
.rollup(values=>values.length)
.entries(dataWithAges)
.sort((a,b)=>a.value<b.value?1:-1)
.filter(d=>d.key!='Not Applicable')
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
ასოები
Insert cell
splitted = ასოები.split('')
Insert cell
რაოდენობები = d3.nest()
.key(d=>d)
.rollup(values=>values.length)
.entries(splitted)
.sort((a,b)=>a.value<b.value?1:-1)
.filter(d=>d.key!=' ')
.filter(d=>d.key!='\n')
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more