Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6542891
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:16:52+00:00 2026-05-25T11:16:52+00:00

Hi I have a pChart 2 bar chart which contains a variable number of

  • 0

Hi I have a pChart 2 bar chart which contains a variable number of bars and as well as the actual value for each bar I wish to display 2 additional values to the right hand side of each bar. Please consider the image below where the values in the rectangle are an example of the figures I need to add to the chart.

enter image description here

Obviously I want to make them look a bit neater than this but really at the moment I am just wondering

What would be the correct way to do this in pChart?
Is there a built in way to perform this kind of decoration?
If not, how should I best align my additional output with each bar in the chart, considering that these bars are variable in pixel size and data size (i.e. this has to be calculated not approximated for a single scenario).

Just for clarity the extra figures are simply the same scores from previous years and would be decorated in a colour border or similar and included in a legend.

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T11:16:53+00:00Added an answer on May 25, 2026 at 11:16 am

    In the drawBarChart() method of the file pDraw.class.php there is the following conditional at the end of that method:

    if ($DisplayPos == LABEL_POS_INSIDE && abs($TxtWidth) < abs($BarWidth)){
    ...
    else{
    

    At the end of that else block is a $this->drawText() method, this outputs the value on the end of the bar and will be called for each bar in the series. You can also at this point write additional values to the end of the chart (in this case the right margin) using the following:

    $itemGap = 45;  //the space between items
    $items = array(1,2,3); //the value to draw
    
    
        $colStart = $this->GraphAreaX2 + $itemGap;
    
        foreach($itemGap as $item)
        {
             $this->drawText($colStart, $Y + $YOffset + $YSize / 2, $item, array("R" => $DisplayR, "G" => $DisplayG, "B" => $DisplayB, "Align" => $Align, "FontSize"  => $DisplaySize));
             $colStart += $itemGap;
        }
    

    I hope that is helpful to someone.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Windows Service written in Delphi which runs a number of programs.
Have just started using Visual Studio Professional's built-in unit testing features, which as I
Have you determined a maximum number of characters allowed in FCKEditor ? I seem
I have a lot of memory allocations and the same number of FreeMem calls.
I have some MSVC++ compiled DLL's for which I have created COM-like (lite) interfaces
I have a backup system which uses a TStringList, but I code with an
I have the method (Delphi 2009): procedure TAnsiStringType.SetData(const Value: TBuffer; IsNull: boolean = False);
I have a DLL in which I have a function that returns a pchar.
I have a dll which procedure accepts: const buffer parameter. There is also an
I have a DLL which takes care of custom drawing for some special glass

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.