If its important that the value you derive relates to the peak as displayed on the graph generated by Excel, then deriving that value mathematically will require you to effectively reverse engineer the curve fitting algorithm that Excel uses. Unless this happens to be well documented, you are likely to have quite a hard time.

Given that the point of interest is being interpolated from sets of discrete inputs, it is at best, a guess. So using that instead of say the nearest, highest X value from the data is really just deriving false accuracy.

However, if you still wish to do this, there is a way that you could do it without needing to redo all the math.

The approach would be to import the graph itself from Excel as a bitmap, and then the scan the pels from the top, line by line until you encounter 1 or more pels set to the line color. You would need to skip over any pels on the left that represent the Y-Axis and Y-axis labels, but that should just mean starting at a constant offset.

Importing the bitmap from Excel using Win32:::OLE should be a snap. You could probably use GD and $image->getPixel($x,$y) to inspect and detect the pel(s) of interest.

One problem is that I don't see any GD methods for importing Windows style bitmaps. You can import JPG's and PNG's, but both are lossy anyway, and as GD operates on 8-bit pixels the conversion from 24-bit could muddy the waters somewhat.

Just another of my lateral thinking exercises. Good luck.


Okay you lot, get your wings on the left, halos on the right. It's one size fits all, and "No!", you can't have a different color.
Pick up your cloud down the end and "Yes" if you get allocated a grey one they are a bit damp under foot, but someone has to get them.
Get used to the wings fast cos its an 8 hour day...unless the Govenor calls for a cyclone or hurricane, in which case 16 hour shifts are mandatory.
Just be grateful that you arrived just as the tornado season finished. Them buggers are real work.


In reply to Re: graphs by BrowserUk
in thread graphs by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.