Platform
Solutions
Resources
Pricing
Sign in
Sign up
Alexandre R. Cajazeira Ramos
Mestre em Ciência da Computação (UFC / MDCC), Especialista em Gestão de TI (UCAM) e Bacharel em Sistemas de Informação (UFPI / CSHNB). Atualmente é Cientista de Dados na central de jornalismo de dados do O POVO - DATADOC.
Workspace
Fork
Public
By
Alexandre R. Cajazeira Ramos
Edited
Jun 27, 2023
Insert cell
Insert cell
Insert cell
async
function
loadData
(
url
)
{
return
fetch
(
url
,
{
Method
:
"GET"
}
)
.
then
(
(
response
)
=>
{
return
response
.
json
(
)
;
}
)
.
then
(
(
data
)
=>
{
return
data
.
dados
;
// ".dados" faz parte da estruturação da API
}
)
}
Insert cell
data
=
fetch
(
url_base
)
.
then
(
(
response
)
=>
response
.
json
(
)
)
Insert cell
data1
=
data
.
value
Insert cell
data1
Filter
Columns
Sort
Slice
Save
Type Table, then Shift-Enter. Ctrl-space for more options.
Insert cell
Plot
.
plot
(
{
marks
:
[
Plot
.
barY
(
data
.
value
,
{
x
:
"DOTACAO_ATUALIZADA"
,
y
:
"UNIDADE_ORCAMENTARIA"
,
sort
:
{
y
:
"x"
,
reverse
:
true
}
}
)
,
Plot
.
ruleY
(
[
0
]
)
]
}
)
Insert cell
[
...
new
Set
(
data
.
value
.
map
(
d
=>
d
.
UNIDADE_ORCAMENTARIA
)
)
]
Insert cell
Insert cell
unidade
Insert cell
dados_unidade
=
data
.
value
.
filter
(
d
=>
(
unidade
==
'Todas'
||
d
.
UNIDADE_ORCAMENTARIA
==
unidade
)
)
Insert cell
Insert cell
Insert cell
Insert cell
Treemap
(
flare
,
{
path
:
(
d
)
=>
d
.
name
.
replaceAll
(
"."
,
"/"
)
,
// e.g. flare/animate/Easing
label
:
(
d
)
=>
d
.
name
.
split
(
"."
)
.
pop
(
)
,
// display text
group
:
(
d
)
=>
d
.
name
.
split
(
"."
)
[
1
]
,
// for color; e.g. animate
value
:
(
d
)
=>
d
?.
size
,
// area of each rect
title
:
(
d
,
n
)
=>
[
n
.
id
,
n
.
value
.
toLocaleString
(
)
]
.
join
(
"\n"
)
,
// hover text
width
,
height
:
500
}
)
Insert cell
import
{
Treemap
}
from
"@d3/treemap"
Insert cell
One platform
to build and deploy the best data apps
Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Try it for free
Learn more
Fork
View
Export
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
url_base
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
loadData
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
data
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
data1
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
data2
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
Cells
data1
File attachments
Databases
Filter
Column
Operator
Columns
Sort
Column
Direction
Descending
Ascending
Slice
From
Start
To
End
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
unidade
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
dados_unidade
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
d3
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML