Jump to content
Software FX Community

Using a Cross Tab chart


User (Legacy)

Recommended Posts

Hi,

I have a question regarding generating charts using the Cross Tab Provider.

The result of executing a query is as follows

Sex Weight PatientsId

F 169 1

M 169 2

F 169 3

I need to generate a bar chart with #Patients on the Y-Axis and Weight on

the X-Axis grouped by sex. The following code seems to work well

function MakeXTabBar(sqlString, intHeight, intWidth, strTopTitle,

strXTitle, strYTitle, aryGraphAttributes)

{

// Chart object

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

// ADO Recordset object

var rstADO;

// Retrieve recordset

rstADO = GetDBRecord(sqlString);

// If recordset object was returned without errors

if(rstADO != null)

{

// If chart object was created without errors, set the chart parameters

if(chart1 != null)

{

chart1.SerLegBox = true;

chart1.TopFont.Name = "Book Antiqua";

chart1.TopFont.Weight = 700;

chart1.TopFont.Size = 12;

// display data table

chart1.DataEditor = false;

// Use the resultset inside the ChartFX ADO Provider

CfxAdo = Server.CreateObject("CfxData.ADO");

if(CfxAdo!=null)

{

CfxAdo.ResultSet = rstADO;

CfxCrosstab = Server.CreateObject("SfxCrosstab.DataProvider");

if(CfxCrosstab!=null)

{

CfxCrosstab.DataSource = CfxAdo;

CfxCrosstab.DataType(0) = CTDT_COLUMNHEADING

CfxCrosstab.DataType(1) = CTDT_ROWHEADING

CfxCrosstab.DataType(2) = CTDT_VALUE

chart1.GetExternalData(CfxCrosstab);

}

}

}

Response.Write(chart1.GetHtmlTag(intWidth, intHeight, "Image"));

The only requirement is that the X-Axis values are not uniform. Is there a

way to do this ?

chart.RecalcScale(); - seems to be working only for the Y-Axis.

Any help would be greatly appreciated !

Thanks a bunch !

Sripresanna

post-2107-13922389605373_thumb.png

Link to comment
Share on other sites

>> The only requirement is that the X-Axis values are not uniform. Is there

a way to do this ?

I am not sure I understand your question, can you post the chart that you

get and the one you are looking for (along with the data for that chart).

--

Regards,

JC

Software FX Support

"Sripresanna Narayanasamy" <presannan@ARTHRITIS.ARIZONA.EDU> wrote in

message news:WEl38VT0CHA.2132@webserver1.softwarefx.com...

> Hi,

>

> I have a question regarding generating charts using the Cross Tab

Provider.

> The result of executing a query is as follows

> Sex Weight PatientsId

> F 169 1

> M 169 2

> F 169 3

>

> I need to generate a bar chart with #Patients on the Y-Axis and Weight on

> the X-Axis grouped by sex. The following code seems to work well

>

> function MakeXTabBar(sqlString, intHeight, intWidth, strTopTitle,

> strXTitle, strYTitle, aryGraphAttributes)

> {

> // Chart object

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

>

> // ADO Recordset object

> var rstADO;

>

> // Retrieve recordset

> rstADO = GetDBRecord(sqlString);

>

> // If recordset object was returned without errors

> if(rstADO != null)

> {

> // If chart object was created without errors, set the chart parameters

> if(chart1 != null)

> {

> chart1.SerLegBox = true;

>

> chart1.TopFont.Name = "Book Antiqua";

> chart1.TopFont.Weight = 700;

> chart1.TopFont.Size = 12;

>

> // display data table

> chart1.DataEditor = false;

>

> // Use the resultset inside the ChartFX ADO Provider

> CfxAdo = Server.CreateObject("CfxData.ADO");

>

> if(CfxAdo!=null)

> {

> CfxAdo.ResultSet = rstADO;

>

> CfxCrosstab = Server.CreateObject("SfxCrosstab.DataProvider");

>

> if(CfxCrosstab!=null)

> {

> CfxCrosstab.DataSource = CfxAdo;

>

> CfxCrosstab.DataType(0) = CTDT_COLUMNHEADING

> CfxCrosstab.DataType(1) = CTDT_ROWHEADING

> CfxCrosstab.DataType(2) = CTDT_VALUE

>

> chart1.GetExternalData(CfxCrosstab);

> }

> }

> }

> Response.Write(chart1.GetHtmlTag(intWidth, intHeight, "Image"));

>

>

> The only requirement is that the X-Axis values are not uniform. Is there a

> way to do this ?

>

> chart.RecalcScale(); - seems to be working only for the Y-Axis.

>

>

>

> Any help would be greatly appreciated !

> Thanks a bunch !

>

> Sripresanna

>

>

>

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...