Page 1 of 1

DateTime AdXY in JScript

Posted: Sat Jul 03, 2004 12:13 pm
by 6922288
I'm trying to add date/time values to X axis in JScript (IE 6.0) - but with no success. Using JScript DateTime object doesn't work, string doesn't work either. Could you tell me the right way to do it, please.

Best regards,
Roman

Posted: Mon Jul 05, 2004 9:58 am
by Pep
Hi Roman,

this can be done (in JavaScript in the following manner:

Code: Select all

SCRIPT LANGUAGE=JAVASCRIPT

function SetLoad(){
var green;
var blue;
var i
  TeeCommander1.ChartLink = TChart1.ChartLink;
    TChart1.Aspect.View3D = false;
    TChart1.AddSeries(0);
    TChart1.AddSeries(0);
    TChart1.AddSeries(4);
    TChart1.AddSeries(1);
    TChart1.Series(3).Marks.Visible = false;

    TChart1.Series(0).XValues.DateTime = true;
    TChart1.Series(1).XValues.DateTime = true;
    TChart1.Series(2).XValues.DateTime = true;
    TChart1.Series(3).XValues.DateTime = true;
    for(i=1;i<30;i++)
 {
 var date = new Date(2002,03,26,12,i,00);
 var rand = Math.random() * 100;
 TChart1.Series(0).AddXY(date.getVarDate(),rand * 2,"",536870912);
 TChart1.Series(1).AddXY(date.getVarDate(),rand,"",536870912);
 TChart1.Series(2).AddXY(date.getVarDate(),rand,"",536870912);
 TChart1.Series(3).AddXY(date.getVarDate(),rand,"",536870912);
 }
    //TChart1.Series(0).FillSampleValues (100);
    //TChart1.Series(1).FillSampleValues (100);
    //TChart1.Series(2).FillSampleValues (100);
    //TChart1.Series(3).FillSampleValues (100);
    TChart1.Axis.Bottom.Labels.DateTimeFormat = "dd/mm/yyyy hh:mm:ss";
    TChart1.Axis.Bottom.Labels.Angle=90;

    TChart1.Axis.Left.AxisPen.Color=0x00FFFF;
    TChart1.Axis.Left.StartPosition = 0;
    TChart1.Axis.Left.EndPosition = 33;

    green = TChart1.Axis.AddCustom(false);
    TChart1.Axis.Custom(green).AxisPen.Color =0xBDB76B;
    TChart1.Axis.Custom(green).StartPosition = 33;
    TChart1.Axis.Custom(green).EndPosition = 66;
    blue = TChart1.Axis.AddCustom(false);
    TChart1.Axis.Custom(blue).AxisPen.Color =0x8B008B;
    TChart1.Axis.Custom(blue).StartPosition = 66;
    TChart1.Axis.Custom(blue).EndPosition = 100;

    TChart1.Series(0).VerticalAxis = 0;
    TChart1.Series(1).VerticalAxis = 0;
    TChart1.Series(2).VerticalAxisCustom=green;
    TChart1.Series(3).VerticalAxisCustom=blue;
    TChart1.Repaint();
}

function doIt(){
    var datemax = new Date(2002,03,26,12,25,00);
    var datemin = new Date(2002,03,26,12,20,00);

TChart1.Axis.Bottom.SetMinMax(datemin.getVarDate(),datemax.getVarDate());
}
/SCRIPT

Posted: Wed Jul 14, 2004 8:59 am
by 6922288
Thanks a lot. I see now that getVarDate() function was the missing part on my side.