Menu

Display Data in stackedbars

2010-03-19
2012-09-07
  • manni mammmut

    manni mammmut - 2010-03-19

    hello,

    is there any way to show the y-data in the Plot? Couldn't find any parameter?

    Thank you,

    bye

     
  • lbayuk

    lbayuk - 2010-03-19

    I checked and no, unfortunately, the Y data labels enabled with
    $plot->SetDataLabelPos('plotin') only work with bar charts, not stacked bars.

    While it might be easy enough to implement Y data labels for stacked bars, I'm
    not sure how they would work. If we put one value on top of the bar, it would
    have to be the sum of the data values at that position - the stacked height.
    That really only tells you part of the information represented in the plot.
    Any thoughts or ideas on this would be welcome.

     
  • manni mammmut

    manni mammmut - 2010-03-20

    hello Ibayuk,

    maybe sort of ?

    greetings...

     
  • lbayuk

    lbayuk - 2010-03-21

    I like it. I thought about something like that - putting the labels inside -
    but I thought they would be unreadable with the bar shading. Not bad, although
    they do blur a little in that image, probably because it is JPEG, which isn't
    the best choice for this.

    How about creating a new feature request in the feature request tracker for
    this? (I like to have a bug or feature request item for everything that
    changes in PHPlot for documentation.) I'll do it if you prefer not to.

     
  • manni mammmut

    manni mammmut - 2010-03-21

    yeah, awesome.

    Feature Request - with a PNG :)

     
  • lbayuk

    lbayuk - 2010-03-21

    Thanks for opening the feature request. I noticed there were two, and they
    looked identical, so I marked 2974000 as "deleted, duplicate" and kept 2973995
    https://sourceforge.net/tracker/?func=detail&aid=2973995&group_id=14653&atid=
    364653

     
  • manni mammmut

    manni mammmut - 2010-03-21

    yepp, sorry about that, my fault.

    Bye

     
  • lbayuk

    lbayuk - 2010-03-22

    FYI, I added comments to the feature request, and actually coded up a first
    implementation. There are some questions or issues that you might be able to
    help with.

    1. I made SetYDataLabelPos('plotin') turn on the data label at the top of the bar only, and SetYDataLabelPos('plotstack') turns on both the data label at the top and the labels inside the bars. Do I need an option to turn on only the labels inside?

    2. What if a bar segment is too short for a label to fit? Do I need to check for this and skip the label if it is?

     
  • manni mammmut

    manni mammmut - 2010-03-23

    Hey Ibayuk.

    1) In my particular case I need both labels (the one on the top and the one
    inside the bars) all the the time. No need for an extra option.

    2) The bar segment is usually long enough to display the value, so again -
    there is no need for an extra option...

    You're quiet fast, thank you so much :)

     
  • lbayuk

    lbayuk - 2010-03-23

    OK on labels. I'll leave in two choices: top labels, or both top and inner
    labels.

    I already took care of the bar segment height problem. It wasn't hard to check
    the label height and not draw it if the segment is shorter. (Otherwise the
    plot looks bad, with overlapping text.)

    I'm not going to try to address the issue with the label width (item 3 on my
    comment in the feature request). If the bar isn't wide enough, the label is
    going to extend over the left and right sides.

    I've done enough testing to convince me that it will work (varying text font,
    text height, even angle - which looks weird but still draws right). I will
    probably commit this to CVS soon, but I need to update the reference manual
    before or very soon after. I'm hoping for a new release soon, to include this
    feature and truecolor support. But 'soon' isn't well defined...

     
  • lbayuk

    lbayuk - 2010-03-24

    I committed the changes to CVS yesterday for stacked bar chart data labels,
    including updates to the manual. It will be in the next release, although you
    can grab phplot.php from CVS if you want to take an early look. (You can get
    to it through the Code menu, Browse CVS). Just use
    $plot->SetYDataLabelPos('plotstack') to turn on the labels.

    The next release won't be too far off , but there is one significant change
    still to be finished and committed. This will add support for true-color
    images and transparency (alpha channel). Because there are some unfinished
    parts and I didn't start on the documentation yet, I might release it as an
    "experimental" feature at first.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.