Hi,
There is a bug when modifying the second series in a mixed chart... (See code below). Cht1 is not changing the fillcolor on my second series (The area series). I can only do this by changing changing the color in element 1 (see cht2)
wfcreate(wf = "", page = "Monthly") m 1900 2020
pageselect monthly
smpl @all
series wdearnyoy=5
series wdexpyoy=4
smpl 1990 2015
group g wdearnyoy wdexpyoy
freeze(cht1) g.mixed line(wdearnyoy) area(wdexpyoy)
cht1.addtext(t) ""
cht1.setelem(1) axis(l) legend("Series 1") axis(l) symbol(15) linepattern(1) linewidth(1.0) linecolor(0,80,47) fillcolor(0,80,47)' fillcolor(205,198,179) uncommenting this is the only way to change the fillcolor on series 2
cht1.setelem(2) axis(l) legend("Series 2") symbol(15) linepattern(2) linewidth(1.5) linecolor(205,198,179) fillcolor(205,198,179) 'this line has no effect on series 2
cht1.legend +display position(0.4,-0.33) +inbox
freeze(cht2) g.mixed line(wdearnyoy) area(wdexpyoy)
cht2.addtext(t) ""
cht2.setelem(1) axis(l) legend("Series 1") axis(l) symbol(15) linepattern(1) linewidth(1.0) linecolor(0,80,47) fillcolor(205,198,179)
cht2.setelem(2) axis(l) legend("Series 2") symbol(15) linepattern(2) linewidth(1.5) linecolor(205,198,179) fillcolor(205,198,179) 'this line has no effect on series 2
cht2.legend +display position(0.4,-0.33) +inbox
Mixed Charts
Moderators: EViews Gareth, EViews Moderator
-
- EViews Developer
- Posts: 870
- Joined: Tue Sep 16, 2008 3:50 pm
Re: Mixed Charts
This is actually correct behavior.
The docs for 'setelem' state
Internally, every EViews graph has a set of graph elements. Each element has a fill color, line color, line pattern, etc, etc. In the non-mixed graph case, the graph_elem is the same as series. But in mixed graphs, this is not true. In mixed graphs, the number of elements is equal to max of number of series graphed as lines and max number of series graphed as fills (no. of graph elements = max(no. of lines, no. of fills). Because of this, the call to
is setting the first line color of the graph to red and the first fill color of the graph to blue. This is opposed to, setting the line color for series #1 to red and the fill color for series #1 to blue.
For reasons I will not divulge now, this made the most sense especially when taking into consideration that the individual series types (line, bar, area) can be changed at anytime.
The docs for 'setelem' state
graph_name.setelem(graph_elem) argument_list
where graph_elem is the identifier for the graph element whose options you wish to modify
Internally, every EViews graph has a set of graph elements. Each element has a fill color, line color, line pattern, etc, etc. In the non-mixed graph case, the graph_elem is the same as series. But in mixed graphs, this is not true. In mixed graphs, the number of elements is equal to max of number of series graphed as lines and max number of series graphed as fills (no. of graph elements = max(no. of lines, no. of fills). Because of this, the call to
Code: Select all
cht2.setelem(1) linecolor(red) fillcolor(blue)
is setting the first line color of the graph to red and the first fill color of the graph to blue. This is opposed to, setting the line color for series #1 to red and the fill color for series #1 to blue.
For reasons I will not divulge now, this made the most sense especially when taking into consideration that the individual series types (line, bar, area) can be changed at anytime.
Who is online
Users browsing this forum: No registered users and 14 guests