Re: Shading between lines on chart2D

View: New views
3 Messages — Rating Filter:   Alert me  

Re: Shading between lines on chart2D

by Eugene Lazutkin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Could you elaborate more on "shading"? If it is a different color/fill
between two lines, stacked areas, or even simple areas (you can add
several series to one plot in front-to-back fashion) should fit the
bill. If you have problems with auto-generated colors, you can always
assign fills manually.

Thanks,

Eugene Lazutkin
Dojo Toolkit, Committer
http://lazutkin.com/

On 08/05/2009 12:46 PM, Shruti Krishnagiri wrote:

> I need the ability to provide shading between two series in Chart2D as
> opposed to shading the complete area under the line. What are the
> options to do this? The only way I can think of is stacking the areas,
> but this is a little challenging because of the way the colors on my
> chart stack up.
> I could also use shadows, but I'm not sure how this would scale with
> browser resizes and resolutions.
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> FAQ: http://dojotoolkit.org/support/faq
> Book: http://dojotoolkit.org/docs/book
> Forums: http://dojotoolkit.org/forum
> Dojo-interest@...
> http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest

_______________________________________________
FAQ: http://dojotoolkit.org/support/faq
Book: http://dojotoolkit.org/docs/book
Forums: http://dojotoolkit.org/forum
Dojo-interest@...
http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest

Re: Shading between lines on chart2D

by Eugene Lazutkin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Looks like a good case for stacked areas. You may need to create
"technical" series to get the picture you want. Because in the middle
you have a "hole", assign an empty fill to this area.

In order to reproduce the picture will need to overlay at least three
plots in the same chart:

1) Front: lines with two series --- red and black.

2) Middle: stacked areas with two series filled with empty and grey
fills respectively.

3) Back: stacked areas with three series filled with green, empty, and
red fills respectively.

You may need extra lines to reproduce the horizontal green line, which
goes on top of everything. It can be faked with a series. Another thing
you need to add is a grid. In your case it is the most background plot.

dojox.gfx (the foundation for dojox.charting) supports opacity. So in
order to make an empty fill just assign a color with 0 alpha. Something
like that:

chart.addSeries("Series #3", data, {
  plot: "Plot #2", fill: [0, 0, 0, 0]});

Or you can use a special color name "transparent", if your project
includes dojo.colors.

Thanks,

Eugene Lazutkin
Dojo Toolkit, Committer
http://lazutkin.com/

On 08/10/2009 03:07 AM, Shruti Krishnagiri wrote:

> Thanks for your response Eugene. I have one series in the chart. I also
> have a series with points above this and a series with points below and
> I need to color code this region between the high and low bounds. I
> cannot really use areas in front-to-back fashion because of the
> background that I'm using which has a white strip in between upon which
> the series are plotted. If I use areas, then this would get covered. I'm
> attaching an image of the desired result. I'm trying to get the "gray band".
>  
> On a different note, I need three stacked areas each of a different
> color. The top one starts with red, the middle white and the bottom
> green. With a simple "Areas" type, I can get the bottom 2 showing, I
> cannot get the top one showing at all. I'm defining my top band with two
> points  x:0, y:maxY and x:maxX, y:maxY. If I could get the plot
> background to work with plot "fill", then that would be fine too.
>
> --- On *Fri, 8/7/09, Eugene Lazutkin /<eugene.lazutkin@...>/* wrote:
>
>
>     From: Eugene Lazutkin <eugene.lazutkin@...>
>     Subject: Re: [Dojo-interest] Shading between lines on chart2D
>     To: dojo-interest@...
>     Date: Friday, August 7, 2009, 8:20 AM
>
>     Could you elaborate more on "shading"? If it is a different color/fill
>     between two lines, stacked areas, or even simple areas (you can add
>     several series to one plot in front-to-back fashion) should fit the
>     bill. If you have problems with auto-generated colors, you can always
>     assign fills manually.
>
>     Thanks,
>
>     Eugene Lazutkin
>     Dojo Toolkit, Committer
>     http://lazutkin.com/
>
>     On 08/05/2009 12:46 PM, Shruti Krishnagiri wrote:
>     > I need the ability to provide shading between two series in Chart2D as
>     > opposed to shading the complete area under the line. What are the
>     > options to do this? The only way I can think of is stacking the areas,
>     > but this is a little challenging because of the way the colors on my
>     > chart stack up.
>     > I could also use shadows, but I'm not sure how this would scale with
>     > browser resizes and resolutions.
>     >
>     >
>     >
>     >
>     ------------------------------------------------------------------------
>     >
>     > _______________________________________________
>     > FAQ: http://dojotoolkit.org/support/faq
>     > Book: http://dojotoolkit.org/docs/book
>     > Forums: http://dojotoolkit.org/forum
>     > Dojo-interest@...
>     <http://us.mc318g.mail.yahoo.com/mc/compose?to=Dojo-interest@...>
>     > http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
>
>     _______________________________________________
>     FAQ: http://dojotoolkit.org/support/faq
>     Book: http://dojotoolkit.org/docs/book
>     Forums: http://dojotoolkit.org/forum
>     Dojo-interest@...
>     <http://us.mc318g.mail.yahoo.com/mc/compose?to=Dojo-interest@...>
>     http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> FAQ: http://dojotoolkit.org/support/faq
> Book: http://dojotoolkit.org/docs/book
> Forums: http://dojotoolkit.org/forum
> Dojo-interest@...
> http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest

_______________________________________________
FAQ: http://dojotoolkit.org/support/faq
Book: http://dojotoolkit.org/docs/book
Forums: http://dojotoolkit.org/forum
Dojo-interest@...
http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest

Re: Shading between lines on chart2D

by Eugene Lazutkin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hmm, you are right --- it doesn't work because stacked areas are still
implemented as overlapped shapes. Please submit an enhancement ticket to
implement the true fill between lines.

Thanks,

Eugene Lazutkin
Dojo Toolkit, Committer
http://lazutkin.com/

On 08/13/2009 01:30 AM, Shruti Krishnagiri wrote:

> That's a good idea. For the most part it works ok. However, I don't see
> how the middle can be stacked with empty and grey fills. If the area
> below the blue line is filled empty, then the area behind it which has a
> grey fill shows through.
>
> --- On *Tue, 8/11/09, Eugene Lazutkin /<eugene.lazutkin@...>/* wrote:
>
>
>     From: Eugene Lazutkin <eugene.lazutkin@...>
>     Subject: Re: [Dojo-interest] Shading between lines on chart2D
>     To: dojo-interest@...
>     Date: Tuesday, August 11, 2009, 8:46 AM
>
>     Looks like a good case for stacked areas. You may need to create
>     "technical" series to get the picture you want. Because in the middle
>     you have a "hole", assign an empty fill to this area.
>
>     In order to reproduce the picture will need to overlay at least three
>     plots in the same chart:
>
>     1) Front: lines with two series --- red and black.
>
>     2) Middle: stacked areas with two series filled with empty and grey
>     fills respectively.
>
>     3) Back: stacked areas with three series filled with green, empty, and
>     red fills respectively.
>
>     You may need extra lines to reproduce the horizontal green line, which
>     goes on top of everything. It can be faked with a series. Another thing
>     you need to add is a grid. In your case it is the most background plot.
>
>     dojox.gfx (the foundation for dojox.charting) supports opacity. So in
>     order to make an empty fill just assign a color with 0 alpha. Something
>     like that:
>
>     chart.addSeries("Series #3", data, {
>       plot: "Plot #2", fill: [0, 0, 0, 0]});
>
>     Or you can use a special color name "transparent", if your project
>     includes dojo.colors.
>
>     Thanks,
>
>     Eugene Lazutkin
>     Dojo Toolkit, Committer
>     http://lazutkin.com/
>
>     On 08/10/2009 03:07 AM, Shruti Krishnagiri wrote:
>     > Thanks for your response Eugene. I have one series in the chart. I
>     also
>     > have a series with points above this and a series with points
>     below and
>     > I need to color code this region between the high and low bounds. I
>     > cannot really use areas in front-to-back fashion because of the
>     > background that I'm using which has a white strip in between upon
>     which
>     > the series are plotted. If I use areas, then this would get
>     covered. I'm
>     > attaching an image of the desired result. I'm trying to get the
>     "gray band".
>     >
>     > On a different note, I need three stacked areas each of a different
>     > color. The top one starts with red, the middle white and the bottom
>     > green. With a simple "Areas" type, I can get the bottom 2 showing, I
>     > cannot get the top one showing at all. I'm defining my top band
>     with two
>     > points  x:0, y:maxY and x:maxX, y:maxY. If I could get the plot
>     > background to work with plot "fill", then that would be fine too.
>     >
>     > --- On *Fri, 8/7/09, Eugene Lazutkin /<eugene.lazutkin@...
>     <http://us.mc318g.mail.yahoo.com/mc/compose?to=eugene.lazutkin@...>>/*
>     wrote:
>     >
>     >
>     >     From: Eugene Lazutkin <eugene.lazutkin@...
>     <http://us.mc318g.mail.yahoo.com/mc/compose?to=eugene.lazutkin@...>>
>     >     Subject: Re: [Dojo-interest] Shading between lines on chart2D
>     >     To: dojo-interest@...
>     <http://us.mc318g.mail.yahoo.com/mc/compose?to=dojo-interest@...>
>     >     Date: Friday, August 7, 2009, 8:20 AM
>     >
>     >     Could you elaborate more on "shading"? If it is a different
>     color/fill
>     >     between two lines, stacked areas, or even simple areas (you
>     can add
>     >     several series to one plot in front-to-back fashion) should
>     fit the
>     >     bill. If you have problems with auto-generated colors, you can
>     always
>     >     assign fills manually.
>     >
>     >     Thanks,
>     >
>     >     Eugene Lazutkin
>     >     Dojo Toolkit, Committer
>     >     http://lazutkin.com/
>     >
>     >     On 08/05/2009 12:46 PM, Shruti Krishnagiri wrote:
>     >     > I need the ability to provide shading between two series in
>     Chart2D as
>     >     > opposed to shading the complete area under the line. What
>     are the
>     >     > options to do this? The only way I can think of is stacking
>     the areas,
>     >     > but this is a little challenging because of the way the
>     colors on my
>     >     > chart stack up.
>     >     > I could also use shadows, but I'm not sure how this would
>     scale with
>     >     > browser resizes and resolutions.
>     >     >
>     >     >
>     >     >
>     >     >
>     >
>        ------------------------------------------------------------------------
>     >     >
>     >     > _______________________________________________
>     >     > FAQ: http://dojotoolkit.org/support/faq
>     >     > Book: http://dojotoolkit.org/docs/book
>     >     > Forums: http://dojotoolkit.org/forum
>     >     > Dojo-interest@...
>     <http://us.mc318g.mail.yahoo.com/mc/compose?to=Dojo-interest@...>
>     >
>        <http://us.mc318g.mail.yahoo.com/mc/compose?to=Dojo-interest@...>
>     >     > http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
>     >
>     >     _______________________________________________
>     >     FAQ: http://dojotoolkit.org/support/faq
>     >     Book: http://dojotoolkit.org/docs/book
>     >     Forums: http://dojotoolkit.org/forum
>     >     Dojo-interest@...
>     <http://us.mc318g.mail.yahoo.com/mc/compose?to=Dojo-interest@...>
>     >
>        <http://us.mc318g.mail.yahoo.com/mc/compose?to=Dojo-interest@...>
>     >     http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
>     >
>     >
>     >
>     >
>     ------------------------------------------------------------------------
>     >
>     > _______________________________________________
>     > FAQ: http://dojotoolkit.org/support/faq
>     > Book: http://dojotoolkit.org/docs/book
>     > Forums: http://dojotoolkit.org/forum
>     > Dojo-interest@...
>     <http://us.mc318g.mail.yahoo.com/mc/compose?to=Dojo-interest@...>
>     > http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
>
>     _______________________________________________
>     FAQ: http://dojotoolkit.org/support/faq
>     Book: http://dojotoolkit.org/docs/book
>     Forums: http://dojotoolkit.org/forum
>     Dojo-interest@...
>     <http://us.mc318g.mail.yahoo.com/mc/compose?to=Dojo-interest@...>
>     http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> FAQ: http://dojotoolkit.org/support/faq
> Book: http://dojotoolkit.org/docs/book
> Forums: http://dojotoolkit.org/forum
> Dojo-interest@...
> http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest

_______________________________________________
FAQ: http://dojotoolkit.org/support/faq
Book: http://dojotoolkit.org/docs/book
Forums: http://dojotoolkit.org/forum
Dojo-interest@...
http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest