Jump to content
Software FX Community

Problem adding Gantt chart with JScript - Type Mismatch when entering dates


User (Legacy)

Recommended Posts

Hello,

I am trying to build a Gantt chart with ChartFX Internet using ASP. I'm

coding the ASP with JScript, and I keep getting the following error:

------

Microsoft JScript runtime (0x800A000D)

Type mismatch

------

when the code executes this line:

------

Chart.IniValueEx(x,z) = formatDate(startDate, "MMDDYYYY_HHMMSS");

------

which returns a JavaScript date object. I've also tried returning a

VBScript date ("11/26/2002 8:00:00 AM") but I get the same "Type mismatch"

error. By the way, I'm building the data manually because I'm parsing an

XML document which contains all of the information. What am I doing wrong?

The full code is below, if it helps.

------

//Create graph here

var Chart = Server.CreateObject("ChartFX.WebServer");

Chart.Gallery = GANTT;

Chart.Axis(0).Format = AF_DATE;

//Find maximum number of rack liftings

var supplierAtts, iTemp, numOfMaxRackLiftings = 0;

for (i=0; i<numOfSuppliers; i++) {

supplierAtts = supplierInfo.item(i).attributes;

iTemp = Number(supplierAtts.getNamedItem("numOfRackLiftings").value)

numOfMaxRackLiftings = (iTemp > numOfMaxRackLiftings) ?

iTemp:numOfMaxRackLiftings;

}

//OpenDataEX(Axis, numberOfSeries, numberOfPoints)

Chart.OpenDataEX(COD_VALUES, numOfSuppliers, numOfMaxRackLiftings);

Chart.OpenDataEX(COD_INIVALUES, numOfSuppliers, numOfMaxRackLiftings);

//loop through suppliers to build chart data

var intRackLiftingCounter = 0, intSupplierCounter = 1, numOfRackLiftings,

rackLiftingAtts;

for (x=0; x<numOfSuppliers; x++) {

//get number of rack liftings in current supplier

supplierAtts = supplierInfo.item(x).attributes;

numOfRackLiftings =

Number(supplierAtts.getNamedItem("numOfRackLiftings").value);

//now loop through those rack lifting records

for (z=0; z<numOfRackLiftings; z++) {

rackLiftingAtts =

rackLiftingInfo.item(intRackLiftingCounter).attributes;

//set chart data

Chart.IniValueEx(x,z) =

getVBDate(formatDate(rackLiftingAtts.getNamedItem("loadStartTime").value,

"MMDDYYYY_HHMMSS"));

Chart.ValueEx(x,z) =

getVBDate(formatDate(rackLiftingAtts.getNamedItem("loadEndTime").value,

"MMDDYYYY_HHMMSS"));

intRackLiftingCounter++;

}

intSupplierCounter++;

}

------

Any help would be GREATLY appreciated!

Thanks!

Chad

Link to comment
Share on other sites

IniValueEx is a double property so you will need to transform your date to a

double. You may want to try using the getVarDate method or a similar

conversion. Note that ChartFX will convert the numbers to dates (when

showing labels) using the COM Automation routines.

BTW, in your code you seem to be executing a function called getVBDate, can

you specify what you are doing in it ?

--

Regards,

JC

Software FX Support

"Chad Lansford" <chartfx@shillglen.com> wrote in message

news:66flkYblCHA.1060@webserver1.softwarefx.com...

> Hello,

>

> I am trying to build a Gantt chart with ChartFX Internet using ASP. I'm

> coding the ASP with JScript, and I keep getting the following error:

>

> ------

> Microsoft JScript runtime (0x800A000D)

> Type mismatch

> ------

>

> when the code executes this line:

>

> ------

> Chart.IniValueEx(x,z) = formatDate(startDate, "MMDDYYYY_HHMMSS");

> ------

>

> which returns a JavaScript date object. I've also tried returning a

> VBScript date ("11/26/2002 8:00:00 AM") but I get the same "Type mismatch"

> error. By the way, I'm building the data manually because I'm parsing an

> XML document which contains all of the information. What am I doing

wrong?

> The full code is below, if it helps.

>

>

> ------

> //Create graph here

> var Chart = Server.CreateObject("ChartFX.WebServer");

> Chart.Gallery = GANTT;

> Chart.Axis(0).Format = AF_DATE;

>

> //Find maximum number of rack liftings

> var supplierAtts, iTemp, numOfMaxRackLiftings = 0;

> for (i=0; i<numOfSuppliers; i++) {

> supplierAtts = supplierInfo.item(i).attributes;

> iTemp = Number(supplierAtts.getNamedItem("numOfRackLiftings").value)

> numOfMaxRackLiftings = (iTemp > numOfMaxRackLiftings) ?

> iTemp:numOfMaxRackLiftings;

> }

>

> //OpenDataEX(Axis, numberOfSeries, numberOfPoints)

> Chart.OpenDataEX(COD_VALUES, numOfSuppliers, numOfMaxRackLiftings);

> Chart.OpenDataEX(COD_INIVALUES, numOfSuppliers, numOfMaxRackLiftings);

>

> //loop through suppliers to build chart data

> var intRackLiftingCounter = 0, intSupplierCounter = 1, numOfRackLiftings,

> rackLiftingAtts;

> for (x=0; x<numOfSuppliers; x++) {

> //get number of rack liftings in current supplier

> supplierAtts = supplierInfo.item(x).attributes;

> numOfRackLiftings =

> Number(supplierAtts.getNamedItem("numOfRackLiftings").value);

>

> //now loop through those rack lifting records

> for (z=0; z<numOfRackLiftings; z++) {

> rackLiftingAtts =

> rackLiftingInfo.item(intRackLiftingCounter).attributes;

> //set chart data

> Chart.IniValueEx(x,z) =

> getVBDate(formatDate(rackLiftingAtts.getNamedItem("loadStartTime").value,

> "MMDDYYYY_HHMMSS"));

> Chart.ValueEx(x,z) =

> getVBDate(formatDate(rackLiftingAtts.getNamedItem("loadEndTime").value,

> "MMDDYYYY_HHMMSS"));

> intRackLiftingCounter++;

> }

> intSupplierCounter++;

> }

> ------

>

> Any help would be GREATLY appreciated!

> Thanks!

> Chad

>

>

Attachments.zip

Link to comment
Share on other sites

Thanks.  The getVarDate worked.  The "getVBDate" function was just a hack -

I called a VBScript function from JScript, to return a VB date object...

it's gone now.

However, I'm having another problem now. The information seems to be

displaying incorrectly. It's charted correctly, meaning that the start and

end times that I set are represented correctly. However, when I mouseover

each record, the series seems to be incorrect, and it's color coded wrong.

I'll try to explain:

Here's my data (it's in XML format, so it doesn't actually look like this):

---------------

Series #1 (Represented as "Suppliers" in the code below):

Record #1 (Represented as "Rack Liftings" in the code below):

loadStartTime = "11/18/2002 8:00:00"

loadEndTime = "11/18/2002 9:00:00"

Record #2:

loadStartTime = "11/18/2002 12:00:00"

loadEndTime = "11/18/2002 13:00:00"

Series #2:

Record #1:

loadStartTime = "11/18/2002 11:00:00"

loadEndTime = "11/18/2002 12:00:00"

---------------

Here's my code:

---------------

//loop through suppliers to build chart data

var intRackLiftingCounter = 0, intSupplierCounter = 1, numOfRackLiftings,

rackLiftingAtts;

for (x=0; x<numOfSuppliers; x++) {

//get number of rack liftings in current supplier

supplierAtts = supplierInfo.item(x).attributes;

numOfRackLiftings =

Number(supplierAtts.getNamedItem("numOfRackLiftings").value);

Chart.Axis(2).Label(x) = "Series #" + (x+1);

//now loop through those rack lifting records

for (z=0; z<numOfRackLiftings; z++) {

rackLiftingAtts =

rackLiftingInfo.item(intRackLiftingCounter).attributes;

//set chart data

Chart.IniValueEx(x,z) =

formatDate(rackLiftingAtts.getNamedItem("loadStartTime").value,

"JavaScript").getVarDate();

Chart.ValueEx(x,z) =

formatDate(rackLiftingAtts.getNamedItem("loadEndTime").value,

"JavaScript").getVarDate();

intRackLiftingCounter++;

}

intSupplierCounter++;

}

---------------

Each records' "loadStartTime" and "loadEndTime" is plotted correctly,

however, the chart seems to group them into the incorrect series. So, if I

mouseover the "Series #1/Record #1" record, it says: "Series #1 From 8AM to

9AM" (which is correct). If I mouseover the "Series #2/Record #1" record,

it says "Series #1 From 11AM to 12PM" (the time is correct, but the series

number is not). Then "Series #1/Record #2" says "Series #2 From 12PM to

13PM" (the time is correct, but the series number is not).

I hope this makes sense! Do you have any ideas as to what I might be doing

wrong?

Thanks!

Chad

"Software FX Support" <support@softwarefx.com> wrote in message

news:7KneleilCHA.3044@webserver1.softwarefx.com...

> IniValueEx is a double property so you will need to transform your date to

a

> double. You may want to try using the getVarDate method or a similar

> conversion. Note that ChartFX will convert the numbers to dates (when

> showing labels) using the COM Automation routines.

>

> BTW, in your code you seem to be executing a function called getVBDate,

can

> you specify what you are doing in it ?

>

> --

> Regards,

>

> JC

> Software FX Support

> "Chad Lansford" <chartfx@shillglen.com> wrote in message

> news:66flkYblCHA.1060@webserver1.softwarefx.com...

> > Hello,

> >

> > I am trying to build a Gantt chart with ChartFX Internet using ASP. I'm

> > coding the ASP with JScript, and I keep getting the following error:

> >

> > ------

> > Microsoft JScript runtime (0x800A000D)

> > Type mismatch

> > ------

> >

> > when the code executes this line:

> >

> > ------

> > Chart.IniValueEx(x,z) = formatDate(startDate, "MMDDYYYY_HHMMSS");

> > ------

> >

> > which returns a JavaScript date object. I've also tried returning a

> > VBScript date ("11/26/2002 8:00:00 AM") but I get the same "Type

mismatch"

> > error. By the way, I'm building the data manually because I'm parsing

an

> > XML document which contains all of the information. What am I doing

> wrong?

> > The full code is below, if it helps.

> >

> >

> > ------

> > //Create graph here

> > var Chart = Server.CreateObject("ChartFX.WebServer");

> > Chart.Gallery = GANTT;

> > Chart.Axis(0).Format = AF_DATE;

> >

> > //Find maximum number of rack liftings

> > var supplierAtts, iTemp, numOfMaxRackLiftings = 0;

> > for (i=0; i<numOfSuppliers; i++) {

> > supplierAtts = supplierInfo.item(i).attributes;

> > iTemp = Number(supplierAtts.getNamedItem("numOfRackLiftings").value)

> > numOfMaxRackLiftings = (iTemp > numOfMaxRackLiftings) ?

> > iTemp:numOfMaxRackLiftings;

> > }

> >

> > //OpenDataEX(Axis, numberOfSeries, numberOfPoints)

> > Chart.OpenDataEX(COD_VALUES, numOfSuppliers, numOfMaxRackLiftings);

> > Chart.OpenDataEX(COD_INIVALUES, numOfSuppliers, numOfMaxRackLiftings);

> >

> > //loop through suppliers to build chart data

> > var intRackLiftingCounter = 0, intSupplierCounter = 1,

numOfRackLiftings,

> > rackLiftingAtts;

> > for (x=0; x<numOfSuppliers; x++) {

> > //get number of rack liftings in current supplier

> > supplierAtts = supplierInfo.item(x).attributes;

> > numOfRackLiftings =

> > Number(supplierAtts.getNamedItem("numOfRackLiftings").value);

> >

> > //now loop through those rack lifting records

> > for (z=0; z<numOfRackLiftings; z++) {

> > rackLiftingAtts =

> > rackLiftingInfo.item(intRackLiftingCounter).attributes;

> > //set chart data

> > Chart.IniValueEx(x,z) =

> >

getVBDate(formatDate(rackLiftingAtts.getNamedItem("loadStartTime").value,

> > "MMDDYYYY_HHMMSS"));

> > Chart.ValueEx(x,z) =

> > getVBDate(formatDate(rackLiftingAtts.getNamedItem("loadEndTime").value,

> > "MMDDYYYY_HHMMSS"));

> > intRackLiftingCounter++;

> > }

> > intSupplierCounter++;

> > }

> > ------

> >

> > Any help would be GREATLY appreciated!

> > Thanks!

> > Chad

> >

> >

>

>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...