Page 1 of 1
override text and positioning of marks
Posted: Tue Apr 15, 2014 4:55 am
by 9337315
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?
Re: override text and positioning of marks
Posted: Tue Apr 15, 2014 11:27 am
by yeray
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?
Re: override text and positioning of marks
Posted: Tue Apr 15, 2014 1:26 pm
by 9337315
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)";
}
}
}
Re: override text and positioning of marks
Posted: Wed Apr 16, 2014 4:16 am
by 9337315
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!
Re: override text and positioning of marks
Posted: Wed Apr 16, 2014 9:53 am
by yeray
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;
}