override text and positioning of marks

TeeChart for JavaScript for the HTML5 Canvas
Post Reply
WCantrall
Newbie
Newbie
Posts: 27
Joined: Mon May 03, 2004 4:00 am
Location: USA
Contact:

override text and positioning of marks

Post by WCantrall » Tue Apr 15, 2014 4:55 am

In the vcl and .net versions I have been able to override the behavior of the marks so that I can position a label at the end of lines. How would I start to go about doing that in this version?

Yeray
Site Admin
Site Admin
Posts: 9614
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: override text and positioning of marks

Post by Yeray » Tue Apr 15, 2014 11:27 am

Hello,
WCantrall wrote:In the vcl and .net versions I have been able to override the behavior of the marks so that I can position a label at the end of lines. How would I start to go about doing that in this version?
I'm not sure to understand what are you exactly trying to achieve. Could you please post some code in delphi/C# and maybe an image showing the resulting so we can better understand what are you exactly trying to do?
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

WCantrall
Newbie
Newbie
Posts: 27
Joined: Mon May 03, 2004 4:00 am
Location: USA
Contact:

Re: override text and positioning of marks

Post by WCantrall » Tue Apr 15, 2014 1:26 pm

For instance, this is from the .net tutorial:
OnGetSeriesMark
Use the OnGetSeriesMark event to modify the Mark contents at runtime. The following code varies the MarkText according to the value relative to the last;

Code: Select all

[C#] private void line1_GetSeriesMark(Steema.TeeChart.Styles.Series series, Steema.TeeChart.Styles.GetSeriesMarkEventArgs e)        
   {            
          if(e.ValueIndex > 0)            
          {                 
                if(line1.YValues[e.ValueIndex] > line1.YValues[e.ValueIndex - 1])                
                {                     
                      e.MarkText = e.MarkText + " (Up)";                
                }                
                 else if(line1.YValues[e.ValueIndex] < line1.YValues[e.ValueIndex - 1])                 
                 {                     
                         e.MarkText = e.MarkText + " (Down)";                
                 }                 
            else                
           {                    
                e.MarkText = e.MarkText + " (No Change)";               
            }             
      }        
 } 

WCantrall
Newbie
Newbie
Posts: 27
Joined: Mon May 03, 2004 4:00 am
Location: USA
Contact:

Re: override text and positioning of marks

Post by WCantrall » Wed Apr 16, 2014 4:16 am

OK, I believe I have more of a grasp of this, as I have tried using Chart.ondraw. What I need now is an example of series calc(index,p) to determine the x and y of the data point.
Thanks!

Yeray
Site Admin
Site Admin
Posts: 9614
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: override text and positioning of marks

Post by Yeray » Wed Apr 16, 2014 9:53 am

Hello,

I'm not sure about what are you exactly trying to do but here you have an example of using the series calc function:

Code: Select all

function draw() {
  Chart1=new Tee.Chart("canvas1");
  
  s = new Tee.Bar().addRandom();
  Chart1.addSeries(s);
  
  var myFormat = new Tee.Format(Chart1);
  myFormat.gradient.visible=true;
  myFormat.gradient.colors=["white","lime"];
  myFormat.transparency=0.3;
    
  Chart1.ondraw=function() { 
	  var tmpP = new Point(0,0);
	  for (t=0; t<s.count(); t++) {
		s.calc(t, tmpP);
		myFormat.rectangle(tmpP.x-5, tmpP.y, 10, 5);
	  }
  }
  
  Chart1.draw();
}

function Point(x,y) {
  this.x=x;
  this.y=y;
}
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply