Shade difference between two series in C# chart object

wipnav
wipnav used Ask the Experts™
on
I have a chart with 2 line series: payments received and payments posted.

These series will move independently of each other, some times intersecting when received = posted. Each series can be greater or less than the other.

I would like to shade the difference between the 2 lines - in particular shade the area between the lines when posted > received in GREEN and the shade the area between the lines when posted < received in RED.

Is this possible? (I am still fairly new to C# and charting in general so bear with me!)
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Jeffrey CoachmanMIS Liason
Most Valuable Expert 2012

Commented:
I can't think of an easy way to do this.

Color can only be applied to "Objects".

The "the area between the lines" is not an Object, hence you can't assign it a color.

Furthermore I am an Access programmer and I am not familiar with chart/graph coding in c#

Perhaps there could be a workaround of some sort...
...Can you post a graphical example of the output you are expecting...?

JeffCoachman

Author

Commented:
Here is an idea of what I want except with 2 y values, and when the cross have the fill color change
Jeffrey CoachmanMIS Liason
Most Valuable Expert 2012

Commented:
was there supposed to be a graphic attached...?
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Author

Commented:
Yes...whoops.
Area1.png
Jeffrey CoachmanMIS Liason
Most Valuable Expert 2012

Commented:
Jeffrey CoachmanMIS Liason
Most Valuable Expert 2012

Commented:
Interesting Q...

I will play around with this tonight...
Jeffrey CoachmanMIS Liason
Most Valuable Expert 2012

Commented:
The only way that I know of to do this is with MS Access only (not c#), would that be acceptable?

Author

Commented:
That would be fine, I can try and translate the code into C#
Jeffrey CoachmanMIS Liason
Most Valuable Expert 2012

Commented:
Well, there is no code to get this to work, only manipulation of the chart's design, (again), *In MS Access*
What is being done here would be very complex (even for me) to do in VBA, let alone trying to translate it to c#.

So you will have to be very skilled in manipulating charts in Design (in MS Access) view to do this.

Basically it is exactly what is being done in the Excel link, only I translated it to the unique steps needed to do the same thing in MS Access.

Besides, the draphic example does not seem to match your original question.
Your question stated:
<I have a chart with 2 line series>
<These series will move independently of each other,>
The graphic you posted has *one* series, moving about a Zero baseline.

Also you stated that:
<I would like to shade the difference between the 2 lines - in particular shade the area between the lines when posted > received in GREEN and the shade the area between the lines when posted < received in RED.>
I don't see any green or red values (or any color "change" for that matter) in the graphic you posted only the same color above and below the zero baseline.

So can you post some actual sample data and a graphic based on this sample data with varying colors?

Here I have attached a screenshot of the Access data and the resultant Chart
Again, let me know if this is acceptable, to be sure...

JeffCoachman
untitled.JPG

Author

Commented:
Jeff,

Thank you very much for your time and attention to this question. I know the image that I provided does not exactly match what my question was asking, but I could not find an image online that fit exactly my question.  

I have modified your image (in paint, mind you) to illustrate what I was hoping to achieve. When the purple line is above the blue line, I would like shade the area in red. Conversely, when the blue line as above the purple, I would like the share the area in green.

Does that help?
untitled.jpg
Jeffrey CoachmanMIS Liason
Most Valuable Expert 2012

Commented:
What I posted is as far as I could go, based on the Excel example.

What you are asking for here, (If this is possible at all), will probably end up being something "Custom".

You can contact the author of the Excel article and see if they are willing to take this on:
jon@peltiertech.com

JeffCoachman

Author

Commented:
Can you upload the Access file that you created?

That will be a good start, I will just make my lines thicker so it is easy to see the portion above and below each line.
Jeffrey CoachmanMIS Liason
Most Valuable Expert 2012

Commented:
I'll try to do that tonight
MIS Liason
Most Valuable Expert 2012
Commented:

Author

Commented:
Thank you very much for your help.

From looking at your sample, it looks like I could just plot the lines then 2 seperate area series that would only be plotted when there was a positive / negative delta.
Jeffrey CoachmanMIS Liason
Most Valuable Expert 2012

Commented:
...possibly, I just wanted to at least see if I could get the core concept working..

Thanks for the interesting and thought provoking question!


;-)

Jeff

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial