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

  • SEARCH
  • Home
  • 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 9121759
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T05:56:04+00:00 2026-06-17T05:56:04+00:00

Im struggling to get a simple example working, once i see a working example

  • 0

Im struggling to get a simple example working, once i see a working example i should be fine but cant get to that point, heres my code:

foreach($users as $user => $tbl_user_id)
{
    $query = "SELECT * FROM my_table WHERE name = '$user'". $sel_query_tech . "" ;

    $result = mysql_query($query);
    $query_num_rows = mysql_num_rows($result);
    $tc = mysql_num_rows($query);           

    $user_hours_query = "SELECT * FROM tbl_activity WHERE activity_user_id = '$tbl_user_id' AND activity_task_id = '10' ". $sel_query . "" ;
    $result1 = mysql_query($user_hours_query);
    $hours_worked = 0;

            while ($row1 = mysql_fetch_array($result1))
                {
                $hours_worked += $row1['activity_hrs_done'];
                }

    echo '<tr><td>'.$user.'</td>';
    echo '<td>'.$tbl_user_id.'</td>';
    echo '<td>'. $tc_num_rows.'</td>';
    echo '<td>'. number_format($hours_worked,2).'</td>';
    $rt = number_format($query_num_rows / $hours_worked ,2);
    echo '<td>'. $rt.'</td></tr>';  
    $data[]=number_format($hours_worked,2);
    $p1->SetLegends[]=$user;
    }

// Some data
//$data = array(40,21,17,27,23);

// Create the Pie Graph. 
$graph = new PieGraph(400,200,'auto');
$graph->SetShadow();

// Set A title for the plot
$graph->title->Set("3D Pie Client side image map");
$graph->title->SetFont(FF_FONT1,FS_BOLD);

// Create
$p1 = new PiePlot3D($data);
//$p1->SetLegends(array("Jan (%d)","Feb","Mar","Apr","May","Jun","Jul"));
$targ=array("pie3d_csimex1.php?v=1","pie3d_csimex1.php?v=2","pie3d_csimex1.php?v=3",
            "pie3d_csimex1.php?v=4","pie3d_csimex1.php?v=5","pie3d_csimex1.php?v=6");
$alts=array("val=%d","val=%d","val=%d","val=%d","val=%d","val=%d");
$p1->SetCSIMTargets($targ,$alts);

// Use absolute labels
$p1->SetLabelType(1);
$p1->value->SetFormat("%d kr");

// Move the pie slightly to the left
$p1->SetCenter(0.4,0.5);

$graph->Add($p1);


// Send back the HTML page which will call this script again
// to retrieve the image.
$graph->StrokeCSIM();

I know $p1->SetLegends is wrong as i print_r both that and $data out, $data returns the values but not $p1 but im really a bit lost and could do with some guidance.

If i just use the set values like
$data = array(40,21,17,27,23);
$p1->SetLegends(array(“Jan (%d)”,”Feb”,”Mar”,”Apr”,”May”,”Jun”,”Jul”));

Then it works fine so its something to do with how i pass the info, any ideas?

  • 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-06-17T05:56:06+00:00Added an answer on June 17, 2026 at 5:56 am

    Please write this code into your code. I hope this will help you

       //$p1->SetLegends[]=$user;
        $userarr[] = $user;
    

    then

    $p1 = new PiePlot3D($data);
    //$p1->SetLegends(array("Jan (%d)","Feb","Mar","Apr","May","Jun","Jul"));
    
    $p1->SetLegends($userarr);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been struggling to get a simple DynamicObject example working in .NET 3.5.
I've really been struggling to get working code, good examples, and most importantly, good
I'm struggling with a task that could be very simple but I'm having a
I'm struggling to get my query working. Basically, what it should do is only
I thought this would be very simple but I'm struggling a little. I'm working
I have been struggling all afternoon trying to get a simple mailto: tag to
Struggling to get any list function to work. I've been fine with _show and
Attempting/struggling to get registration and sign-up working within an active admin project. I have
Problem: Been struggling to get my code to load external shaders and it is
I thought this was going to be pretty simple, but I've been struggling with

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.