Method Signatures
#Array methods
bar(x::AbstractVector, y::AbstractVector{<:Union{Missing, Real}})
bar(x::AbstractVector, y::AbstractArray{<:Union{Missing, Real}, 2})
#DataFrame methods
bar(df::AbstractDataFrame, x::Symbol, y::Symbol)
bar(df::AbstractDataFrame, x::Symbol, y::Symbol, group::Symbol)
Optional Arguments
mark::Union{String, AbstractVector} = "bar"
stack::Union{Bool, AbstractVector, Void} = nothing
legend::Bool = false
scale::Bool = false
kwargs... #modifies top-level EChart properties
Examples
Single Series
using ECharts
x = ["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"]
y = [11, 11, 15, 13, 12, 13, 10]
b = bar(x, y)
Single Series - color
keyword
using ECharts
x = ["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"]
y = [11, 11, 15, 13, 12, 13, 10]
bc = bar(x, y, color = "green")
Single Series - horizontal
keyword
using ECharts
x = ["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"]
y = [11, 11, 15, 13, 12, 13, 10]
bch = bar(x, y, color = "lightgray", horizontal = true)
Multiple Series
x = ["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"]
y = [11, 11, 15, 13, 12, 13, 10]
bm = bar(x, hcat(0.95 .* y, 1.25 .* y, y))
Stacked Bar
using ECharts
x = ["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"]
y = [11, 11, 15, 13, 12, 13, 10]
bcs = bar(x, hcat(0.95 .* y, 1.25 .* y, y), color = ["red", "gray", "blue"], stack = true)
Stacked Bar - Ad-Hoc Stacking
The numbers for the stack
keyword indicate which group each series belongs to. In this example, Series 1 and 2 are stacked together as ‘group 1’ and Series 2 is in ‘group 2’. When using this keyword, a group has to be assigned for each series.
using ECharts
x = ["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"]
y = [11, 11, 15, 13, 12, 13, 10]
bcsa = bar(x, hcat(0.95 .* y, 1.25 .* y, y), color = ["red", "gray", "blue"], stack = [1,1,2])
DataFrame with group
argument
using ECharts, DataFrames
x = [0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9]
y = [28, 43, 81, 19, 52, 24, 87, 17, 68, 49, 55, 91, 53, 87, 48, 49, 66, 27, 16, 15]
g = [0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1]
df_merged = DataFrame(x = x, y = y, g = g)
bg = bar(df_merged, :x, :y, :g)