Skip to content

Commit 10ed849

Browse files
committed
add docstring for Legend
1 parent 6a8fb19 commit 10ed849

File tree

2 files changed

+35
-32
lines changed

2 files changed

+35
-32
lines changed

src/charts/legend.jl

+5-32
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,10 @@
1-
LEGEND_DEFAULT = Dict{Symbol, Any}(
2-
:name => nothing, #user can use this to modify a specific legend
3-
:title => nothing, # automatically assign this if user did not provide any value
4-
:orient => :right, # default location of the legend, user can pass [legendX, legendY] directly
5-
:symbol=>nothing,
6-
:columns=>1,
7-
:direction=>:vertical,
8-
:size => 100,
9-
:gradientlength=>nothing,
10-
:gradientthickness=>nothing,
11-
:gridalign=>:each, # :each, :all
12-
:rowspace => 1,
13-
:columnspace=>1,
14-
:values=>nothing, # allow manually insert values
15-
16-
:limit=>nothing, # number of element to display in legend
17-
18-
:d3format=>nothing,
19-
:d3formattype=>nothing,
20-
21-
:font=>nothing,
22-
:italic=>nothing,
23-
:fontweight=>nothing,
24-
:titlefont=>nothing,
25-
:titleitalic=>nothing,
26-
:titlefontweight=>nothing,
27-
:titlesize=>nothing,
28-
:labelfont=>nothing,
29-
:labelitalic=>nothing,
30-
:labelfontweight=>nothing,
31-
:labelsize=>nothing
32-
)
1+
"""
2+
Legend(args...)
333
4+
Represent a Legend with given arguments.
345
6+
$(print_doc(LEGEND_DEFAULT))
7+
"""
358
struct Legend
369
opts
3710
function Legend(; opts...)

src/kwds.jl

+30
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,36 @@ AXES_DEFAULT = SGKwds(
177177

178178
)
179179

180+
LEGEND_DEFAULT = SGKwds(
181+
:name => __dic(:default=> nothing, :__ord=>0, :__cat => "Legend identity", :__doc=>"The legend id which refers to a legend id of a plot."),
182+
:title => __dic(:default=> nothing, :__ord=>5, :__cat => "Title properties", :__doc=>"Legend title."),
183+
:titlefont => __dic(:default=> nothing, :__ord=>5, :__cat => "Title properties", :__doc=>Kwds_docs[:font]),
184+
:titleitalic => __dic(:default=> nothing, :__ord=>5, :__cat => "Title properties", :__doc=>Kwds_docs[:italic]),
185+
:titlefontweight => __dic(:default=> nothing, :__ord=>5, :__cat => "Title properties", :__doc=>Kwds_docs[:fontweight]),
186+
:titlesize => __dic(:default=> nothing, :__ord=>5, :__cat => "Title properties", :__doc=>Kwds_docs[:fontsize]),
187+
:labelfont => __dic(:default=> nothing, :__ord=>6, :__cat => "Labels properties", :__doc=>Kwds_docs[:font]),
188+
:labelitalic => __dic(:default=> nothing, :__ord=>6, :__cat => "Labels properties", :__doc=>Kwds_docs[:italic]),
189+
:labelfontweight => __dic(:default=> nothing, :__ord=>6, :__cat => "Labels properties", :__doc=>Kwds_docs[:fontweight]),
190+
:labelsize => __dic(:default=> nothing, :__ord=>6, :__cat => "Labels properties", :__doc=>Kwds_docs[:fontsize]),
191+
:font => __dic(:default=> nothing, :__ord=>2, :__cat => "Legend appearance", :__doc=>"The default font that will be used for all elements of the legend."),
192+
:italic => __dic(:default=> nothing, :__ord=>2, :__cat => "Legend appearance", :__doc=>"The default font style that will be used for all elements of the legend."),
193+
:fontweight => __dic(:default=> nothing, :__ord=>2, :__cat => "Legend appearance", :__doc=>"The default font weight that will be used for all elements of the legend."),
194+
:d3format => __dic(:default=> nothing, :__ord=>1, :__cat => "Legend options", :__doc=>"Allow users to directly pass a legend format. It must follow the rules described in `d3.format()`."),
195+
:d3formattype => __dic(:default=> nothing, :__ord=>1, :__cat => "Legend options", :__doc=>"If values are time or date, this option can be used to control their format."),
196+
:limit => __dic(:default=> nothing, :__ord=>1, :__cat => "Legend options", :__doc=>"The number of elements to be shown in the legend."),
197+
:orient => __dic(:default=> :right, :__ord=>2, :__cat => "Legend appearance", :__doc=>"The location of the legend. User can pass `[legendX, legendY]` for a precise location."),
198+
:symbol => __dic(:default=> nothing, :__ord=>2, :__cat => "Legend appearance", :__doc=>"Indicate the symbol for discrete type legends."),
199+
:columns => __dic(:default=> 1, :__ord=>2, :__cat => "Legend appearance", :__doc=>"The number of columns to be used to show the legend elements."),
200+
:direction => __dic(:default=> :vertical, :__ord=>2, :__cat => "Legend appearance", :__doc=>"The direction of the legend."),
201+
:size => __dic(:default=> 100, :__ord=>2, :__cat => "Legend appearance", :__doc=>"The legend element size."),
202+
:gradientlength => __dic(:default=> nothing, :__ord=>2, :__cat => "Legend appearance", :__doc=>"Control the size of a gradient type legend."),
203+
:gradientthickness => __dic(:default=> nothing, :__ord=>2, :__cat => "Legend appearance", :__doc=>"Control the size of a gradient type legend (width)."),
204+
:gridalign => __dic(:default=> :each, :__ord=>2, :__cat => "Legend appearance", :__doc=>"Control how to align multiple legends."),
205+
:rowspace => __dic(:default=> 1, :__ord=>2, :__cat => "Legend appearance", :__doc=>"The space between rows."),
206+
:columnspace => __dic(:default=> 1, :__ord=>2, :__cat => "Legend appearance", :__doc=>"The space between columns."),
207+
:values => __dic(:default=> nothing, :__ord=>1, :__cat => "Legend options", :__doc=>"Allow user manually provide the values for the legend."),
208+
)
209+
180210
BAR_DEFAULT = SGKwds(
181211
:x => __dic(:default=> 0, :__ord=>0, :__cat => "Required", :__doc=>"User should pass a single column for plotting the bar chart. User must pass either this or the `y` argument."),
182212
:y => __dic(:default=> 0, :__ord=>0, :__cat=> "Required", :__doc=>"User should pass a single column for plotting the bar chart. User must pass either this or the `x` argument."),

0 commit comments

Comments
 (0)