transparency

TeeChart for PHP
Post Reply
ISVA7655
Newbie
Newbie
Posts: 16
Joined: Tue Aug 23, 2011 12:00 am

transparency

Post by ISVA7655 » Mon Sep 19, 2011 8:43 pm

Thanks for your quick response to my previous question on shadows.
#1)
I'm playing around with the transparency functions on lines and have found some confusing results.

If I draw a line on a canvas the default line is not solid, fair enough.
if I set the transparency of that line to 50 it vanishes, if I set it to 100, 25 or 1 or 0 it's quite quite visible and very dark, at 25 it's darker than default and at 75 it's faded and lighter than default and 25,100,90 etc

values of default,0,100,95 are all the same which is somewhat faded.
value of 25 = darker then default and 100,95,0,1
value of 50 = invisible.. lines are gone.
value of 75 = lightest of all but still visible..

I assumed this seemingly sort of sinusoidal function was due to the interaction of transparency and the dotted line style.. I assumed that transparency of 50 hiding the dots the dotted line didn't hide so they combined to produce an invisible line.

Then I set the pen style to solid line and it behaves exactly the same...now I'm at a loss.
I may have missed a setting somewhere but this seems a bit odd to me..

** my chart is using a default background , white to light grey vertical gradient from top to bottom
my basic chart setup is this:

$chart1 = new TChart(800,600);
$chart1->getChart()->getHeader()->getFont()->setSize(14);
$chart1->getChart()->getHeader()->setText("SCATTER PLOTTER");
$chart1->getAspect()->setView3D(false);
$chart1->getAxes()->setVisible(true); //false turns off the frame.....
$g=$chart1->getGraphics3D();
$g->getBrush()->setVisible(true); //this turned on the color in the free canvas forms

//drawing the lines
//gcoords is my function and translates my graph coordinates to chart coordinates and accounts for reversed axis and such

//$g->getPen()->setStyle(Dashstyle::$SOLID); these are added after the initial dotted line tests..
//$g->getPen()->setColor(Color::BLACK());
$g->getPen()->setTransparency(50); // 25 is darker than 75, 50 is invisible, default is lighter than 25 and 0,1,95,100 are the same as default...ow!


$g->line(gcordsX(0),gcordsY(50),gcordsX(100),gcordsY(50),Color::BLACK(),1); //horizontal (creates 4 quadrants)
$g->line(gcordsX(50),gcordsY(0),gcordsX(50),gcordsY(100),Color::BLACK(),1); //vertical

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: transparency

Post by Narcís » Tue Sep 20, 2011 2:33 pm

Hi ISVA7655,

Can you please attach a simple example we can run "as-is" to reproduce the problem here?

Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

ISVA7655
Newbie
Newbie
Posts: 16
Joined: Tue Aug 23, 2011 12:00 am

Re: transparency

Post by ISVA7655 » Tue Sep 20, 2011 4:25 pm

Here is a file I made to test this issue, you can just add a ?trv=xx as a get to change the transparency value quickly.. again
on my server a transparency value of 50 makes the 2 lines I have drawn invisible and other values don't make sense.. 25 is darker than 75 etc..90 is darker than 75..

I can provide a link to the working file on my server, although I'd rather email that to someone :)



<?php
/**
* Created by JetBrains PhpStorm.
* User: demo
* Date: 9/20/11
* Time: 11:52 AM
* To change this template use File | Settings | File Templates.
*/

include ("include/tcsource/TChart.php");

// prep graph area

$chart1 = new TChart(800,600);
$chart1->getChart()->getHeader()->getFont()->setSize(14);
$chart1->getChart()->getHeader()->setText("SCATTER PLOTTER");
$chart1->getAspect()->setView3D(false);
$chart1->getAxes()->setVisible(true); //false turns off the frame.....

//**** create graph.. annotation tools are part of graph ..other stuff drawn on top of graph
$chart1->render("chart1.png");

$g=$chart1->getGraphics3D();
$g->getBrush()->setVisible(true); //this turned on the color in the free canvas forms

$trv= $_GET[trv];

if (($trv <= 100) and ($trv >=0)) {
$g->getPen()->setTransparency($trv);
echo "transparency set to $trv <br>";
}

$g->line(50,300,750,300,Color::BLACK(),1); //horizontal
$g->line(400,50,400,750,Color::BLACK(),1); //vertical


imagepng($chart1->getChart()->getGraphics3d()->img, "chart1.png"); //this seems to draw the image when ready

$rand=rand();
print '<font face="Verdana" size="2">Annotation Tool<p>';
print '<img src="chart1.png?rand='.$rand.'"><p>';

//end of php file
?>

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: transparency

Post by Narcís » Wed Sep 21, 2011 9:34 am

Hi ISVA7655,

Thanks for the code.
If I draw a line on a canvas the default line is not solid, fair enough.
Using your code and adding a line series to the chart I got a solid line:

Code: Select all

      $chart1 = new TChart(800,600);
      $chart1->getChart()->getHeader()->getFont()->setSize(14);
      $chart1->getChart()->getHeader()->setText("SCATTER PLOTTER");
      $chart1->getAspect()->setView3D(false);
      $chart1->getAxes()->setVisible(true); //false turns off the frame.....
      $chart1->addSeries(new Line());
      $chart1->getSeries(0)->FillSampleValues();

      //**** create graph.. annotation tools are part of graph ..other stuff drawn on top of graph
      $chart1->render("chart1.png");

      $g=$chart1->getGraphics3D();
      $g->getBrush()->setVisible(true); //this turned on the color in the free canvas forms

      $trv= $_GET[trv];

      if (($trv <= 100) and ($trv >=0)) {
        $g->getPen()->setTransparency($trv);
        echo "transparency set to $trv <br>";
      }

      $g->line(50,300,750,300,Color::BLACK(),1); //horizontal
      $g->line(400,50,400,750,Color::BLACK(),1); //vertical

      imagepng($chart1->getChart()->getGraphics3d()->img, "chart1.png"); //this seems to draw the image when ready

      $rand=rand();
      print '<font face="Verdana" size="2">Annotation Tool<p>';
      print '<img src="chart1.png?rand='.$rand.'"><p>';
What I found is that setting transparency to:

0 I got no transparency.
From 1 to 49 I got black lines.
50 lines were fully transparent.
From 51 to 99 transparency gradually decreased.
100 I got no transparency.

Is this the same you observed? Anyway, I added this issue (TF90015746) to the defect list to be investigated.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

ISVA7655
Newbie
Newbie
Posts: 16
Joined: Tue Aug 23, 2011 12:00 am

Re: transparency

Post by ISVA7655 » Wed Sep 21, 2011 7:23 pm

Thanks for your reply.

I don't get the expected results as you do. I even added your 2 lines to make the graph a line chart vs my own case where it was a blank and all i had was the 2 lines I use to create the 4 quadrants.

Interestingly.. to me when I add your line graph and sample data I get a few new twists.
1) the line style of my 2quadrant defining lines changes to a solid line type. That makes some sense it's the last brush style used so my lines use it.
2) The color of the 2 quadrant lines is either black or the same color as the data series.. it changes depending on the transparency value... that seems odd to me.
3) for me,,,
50 = invisible or full transparency.
1-49 are darker than 51-99
so its almost like sine wave...
50 for me maps to 100 for you.
1-49 for you map to 51-99 for me.
51-99 for you map to 1-49 for me

I'm not certain there is a difference on mine between say 51 and 52 you need to goto 55 to really be certain the transparency has changed but the solid line style help make that easier to see.

It sounds like the issue has to be in my php install, alas I'm on a share hosting account and have no real control over anything.

Any suggestions as to what might influence this ?

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: transparency

Post by Narcís » Thu Sep 22, 2011 9:36 am

Hi ISVA7655,

I can only think of 2 things that could make a difference:

1. That you are using an older TeeChart PHP version than me. I'm using our latest sources, I could send them to you if you want.
2. I'm using Embarcadero's Rad PHP, this environment could have a different behaviour.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply