Comentários (3)

1 mrosado37 comentou às Link permanente

Very useful information but although I went through all the steps, the altered bar colors did not show up in the new chart. Other formatting conditions did replicate beautifully. Any ideas?

2 Louis K comentou às Link permanente

Yes unfortunately this doesn't work very well if you change the color of an individual bar. When you change the color of one or more data elements, the Chart Editor creates a new hidden variable (e.g. named interval_jobcat_exceptions_col). That variable controls the colors of each individual bar. Without data for this variable, the new color override will be ignored.

3 Louis K comentou às Link permanente

After thinking about this some more, I realized there is a way to do this if you are willing to modify the pasted GPL a bit.

 
Take a look at this GPL snippet. This is from a graph I created from the sample Employee Data.sav file shipped with the product. I created a bar chart of counts using the jobcat variable:
 
TRANS: manager = eval(jobcat=3 ? "Manager" : "Not Manager")
SCALE: cat(aesthetic(aesthetic.color), map(("Manager", color.green), ("Not Manager", color.red)))
ELEMENT: interval(position(jobcat*COUNT), shape.interior(shape.square), color(manager))
 
Here I added a TRANS statement to create a new variable "manager" which is set to "Manager" whenever the jobcat variable is 3, otherwise it is set to "Not Manager". Note you could modify your dataset using COMPUTE to do the same thing, but this keeps your dataset unchanged.
Then I added a SCALE statement to map all "Manager" values to be green, and "Not Manager" values to be red.
Finally I added ", color(manager)" to my ELEMENT statement so that the bars would be colored by this new variable.
 
Once you do this the above procedure works as described.
If you do this the

Incluir um Comentário Incluir um Comentário