Skip to content

Commit f1cd68b

Browse files
authored
Merge pull request #49 from randyzwitch/wai_aria
WAI-ARIA compatibility
2 parents b6e7798 + 1c15721 commit f1cd68b

File tree

5 files changed

+51
-3
lines changed

5 files changed

+51
-3
lines changed

docs/_data/sidebars/mydoc_sidebar.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ entries:
104104
output: web
105105
folderitems:
106106

107+
- title: aria!
108+
url: /aria
109+
output: web
110+
107111
- title: colorscheme!
108112
url: /colorscheme
109113
output: web

docs/aria.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
title: aria!
3+
sidebar: mydoc_sidebar
4+
permalink: /aria
5+
---
6+
This method implements the [Web Accessibility Initiative – Accessible Rich Internet Applications](https://www.w3.org/WAI/intro/aria) (WAI-ARIA) functionality that is built into the echarts.js library. echarts.js attempts to [auto-generate valid accessibility tags](http://echarts.baidu.com/option.html#aria), descriptions, etc. based on `ECharts` data such as `Title`.
7+
8+
If you need finer-grained control, the `aria!()` method allows for overriding the auto-generated descriptions and tags.
9+
10+
## Method Signatures
11+
{% highlight julia %}
12+
aria!(ec::EChart; show::Bool = true, description::String = "", general::Dict = Dict(), series::Dict = Dict(), data::Dict = Dict())
13+
{% endhighlight %}
14+
15+
## Optional Arguments
16+
{% highlight julia %}
17+
None currently
18+
{% endhighlight %}
19+
20+
## Examples
21+
22+
### `palette`
23+
{% highlight julia %}
24+
25+
{% endhighlight %}
26+
27+
<div id="color1" style="height:400px;width:800px;"></div>
28+
<script type="text/javascript">
29+
30+
// Initialize after dom ready
31+
var myChart = echarts.init(document.getElementById("color1"), JSON.parse(roma()));
32+
33+
// Load data into the ECharts instance
34+
myChart.setOption(
35+
36+
);
37+
</script>

src/ECharts.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ module ECharts
3535

3636
export title!, yaxis!, xaxis!, toolbox!, colorscheme!, flip!, seriesnames!, legend!, slider!, smooth!
3737
export yline!, xline!, lineargradient, radialgradient, text!, xarea!, yarea!, xgridlines!, ygridlines!
38-
export radial!, jitter!, labels!, theme!, tooltip!
38+
export radial!, jitter!, labels!, theme!, tooltip!, aria!
3939

4040
#This is a package local function, it is NOT overloading JSON.json
4141
#Define custom JSON serialization rule
@@ -78,6 +78,7 @@ module ECharts
7878
include("chartopts/theme.jl")
7979
include("chartopts/radial.jl")
8080
include("chartopts/gradients.jl")
81+
include("chartopts/aria.jl")
8182

8283
#Plots
8384
include("plots/xy_plot.jl")

src/chartopts/aria.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
function aria!(ec::EChart; show::Bool = true, description::Union{String, Void} = nothing, general::Union{Dict, Void} = nothing, series::Union{Dict, Void} = nothing, data::Union{Dict, Void} = nothing)
2+
3+
ec.aria = Aria(show = show, description = description, general = general, series = series, data = data)
4+
return ec
5+
6+
end

src/definetypes.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,7 @@ end
679679
sourceHeader::Union{Bool, Void} = nothing
680680
end
681681
@with_kw mutable struct Aria <: AbstractEChartType
682-
show::Union{Bool, Void} = nothing
682+
show::Union{Bool, Void} = true
683683
description::Union{String, Void} = nothing
684684
general::Union{Dict, Void} = nothing
685685
series::Union{Dict, Void} = nothing
@@ -1405,7 +1405,7 @@ end
14051405
graphic::Union{Graphic,Void} = nothing
14061406
calendar::Union{Calendar,Void} = nothing
14071407
dataset::Union{Dataset, Void} = nothing
1408-
aria::Union{Aria, Void} = nothing
1408+
aria::Union{Aria, Void} = Aria()
14091409
series::Union{AbstractVector{<:AbstractEChartSeries},Void} = nothing
14101410
color::Union{AbstractVector,JSFunction,Void} = nothing
14111411
backgroundColor::Union{String,Void, JSFunction} = nothing

0 commit comments

Comments
 (0)