The triumph of chatbot DeepSeek becoming industry leader was the
first sensational AI news of 2025.
Turns out it can write pretty good echarty code too!
Not yet 100%, but comes very close. Who would complain when a robot
writes the majority of your code ?
Here are a few examples.
Prompt: write echarty code of a bar chart showing market capitalization of the ten most valuable companies
# code generated 100% by DeepSeek
# Sample data (values in trillions USD)
companies <- data.frame(
company = c('Apple', 'Microsoft', 'Saudi Aramco', 'Alphabet', 'Amazon',
'NVIDIA', 'Meta', 'Tesla', 'Berkshire', 'TSMC'),
market_cap = c(2.95, 2.78, 2.43, 1.72, 1.52,
1.34, 1.08, 0.85, 0.82, 0.72)
)
# Create interactive bar chart
ec <- companies |>
ec.init(
preset = FALSE,
xAxis = list(
type = 'value',
axisLabel = list(
formatter = htmlwidgets::JS("function(value) {return '$' + value + 'T';}")
)
),
yAxis = list(
type = 'category',
data = companies$company
),
series = list(
list(
type = 'bar',
data = companies$market_cap,
itemStyle = list(color = '#5470C6'),
label = list(show = TRUE, position = 'right')
)
),
title = list(
text = 'Top 10 Companies by Market Capitalization',
subtext = 'Values in Trillions USD (2023)',
left = 'center'
),
tooltip = list(
trigger = 'axis',
formatter = htmlwidgets::JS(
"function(params) {
return params[0].name + '<br/>Market Cap: $' + params[0].value + 'T';
}"
)
)
) |>
ec.theme("dark") # Try "vintage", "roma", or remove this line for light theme
# Display the chart
ec
Prompt: write echarty code of a zoomable tree chart showing the hierarchy of the European Union government
# code generated by DeepSeek, manually added NOTEs
# Hierarchy data of the European Union government
eu_hierarchy <- list(
name = "European Union",
children = list(
list(
name = "European Council",
children = list(
list(name = "President\n(Charles Michel)"),
list(name = "Summits\n(4/year minimum)")
)
),
list(
name = "European Parliament",
children = list(
list(name = "President\n(Roberta Metsola)"),
list(
name = "Political Groups",
children = list(
list(name = "EPP Group"),
list(name = "S&D Group"),
list(name = "Renew Europe"),
list(name = "Greens/EFA")
)
),
list(
name = "Committees",
children = list(
list(name = "AFET\n(Foreign Affairs)"),
list(name = "LIBE\n(Civil Liberties)"),
list(name = "ECON\n(Economic Affairs)")
)
)
)
),
list(
name = "Council of the EU",
children = list(
list(name = "Presidency\n(Rotating)"),
list(
name = "Configurations",
children = list(
list(name = "General Affairs"),
list(name = "ECOFIN"),
list(name = "FAC\n(Foreign Affairs)")
)
)
)
),
list(
name = "European Commission",
children = list(
list(name = "President\n(Ursula von der Leyen)"),
list(
name = "Directorates-General",
children = list(
list(name = "DG COMP\n(Competition)"),
list(name = "DG CLIMA\n(Climate)"),
list(name = "DG JUST\n(Justice)")
)
)
)
),
list(
name = "Court of Justice",
children = list(
list(name = "CJEU\n(Court of Justice)"),
list(name = "General Court")
)
),
list(
name = "European Central Bank",
children = list(
list(name = "Executive Board"),
list(name = "Governing Council"),
list(name = "Supervisory Board")
)
)
)
)
# Create zoomable tree chart
ec <- ec.init(
preset = FALSE,
series = list(
list(
type = "tree",
roam= TRUE, # NOTE: "zoomable" was missing, manually added
data = list(eu_hierarchy),
top = "5%",
bottom = "5%",
layout = "orthogonal",
orient = "LR", # Left-to-right orientation
expandAndCollapse = TRUE,
initialTreeDepth = 2,
label = list(
position = "left",
verticalAlign = "middle",
align = "right",
fontSize = 12,
formatter = htmlwidgets::JS("function(params) { return params.name.replace('\\n', ' '); }")
),
leaves = list(
label = list(
position = "right",
align = "left"
)
),
lineStyle = list(
color = "#555",
curveness = 0.5
),
itemStyle = list(
color = htmlwidgets::JS(" // NOTE: hallucinations
function(params) {
const colors = ['#5470C6', '#91CC75', '#FAC858', '#EE6666'];
return colors[params.depth % colors.length];
}
")
),
emphasis = list(
focus = "descendant",
itemStyle = list(
color = "#EE6666"
)
)
)
),
tooltip = list(
trigger = "item",
formatter = htmlwidgets::JS("
function(params) {
return params.name.replace('\\n', ' ');
}
")
),
title = list(
text = "European Union Government Hierarchy",
subtext = "Zoomable Tree Chart",
left = "center"
)
)
# Display the chart
ec
Prompt: Given the following CSV data with
header:
name,value
France,20
Brazil,6
Algeria,19
China,61
write R code with library echarty for a map chart with visualMap coloring
# code generated by DeepSeek, manually added NOTEs
# Create data with corrected country names to match map identifiers
data <- data.frame(
name = c("France", "Brazil", "Algeria", "China"),
value = c(20, 6, 19, 61)
)
# Create the map
ec.init(
load='world', # Note: added
#) |> ecs.updater( list( # Note: removed
series = list(list(
type = 'map',
map = 'world',
data = lapply(1:nrow(data), function(i) {
list(name = data$name[i], value = data$value[i])
})
)),
visualMap = list(
type = 'continuous',
min = min(data$value),
max = max(data$value),
text = c('High', 'Low'),
orient = 'vertical',
left = 'right',
top = 'center',
inRange = list(color = c('#91cc75', '#fc8452'))
),
title = list(
text = 'Country Values Map',
subtext = 'Example with visualMap coloring'
)
#)
)
See also JavaScript
code generated for ECharts.
The coding robots are here, act accordingly 🤖