Jump to content
Software FX Community

RE: Dual Y-Axis


Software FX

Recommended Posts

See thread in client newsgroup. 

Regards,

Juan Cegarra

Software FX, Inc.

http://support.softwarefx.com

-----Original Message-----

From: David Patrick [ mailto:dpatrick@msotech.com]

Posted At: Monday, April 10, 2000 1:29 PM

Posted To: Server

Conversation: Dual Y-Axis

Subject: Dual Y-Axis

I'm working with the IE 2000 server demo and have a few questions.

I'm running on an NT4.0 SP6 box acting as both client and server. My data

is coming from an Access database via a ADO recordset. The data set

contains six fields, five series with each series having 3,232 points. The

sixth series is the X coordinate. I'm using a Line type chart.

1. The series legend kept defaulting to the field names from my SQL query

instead of what I thought I was setting it to via the

ChartFX1.Series(0).Legend = "DC Voltage" statement. However when I set the

series legend text after I assigned the recordset to the chart object my

series legend displayed my desired text. Is this what you expect and if so

why?

2. Can I have two series legends? One for each Y axis?

3. The AdjustScale parameter doesn't appear to work on AXIS_Y2 if it is

also applied to AXIS_Y. I get "nice" values on AXIS_Y but not AXIS_Y2.

Shouldn't I expect to get "nice" values on AXIS_Y2?

4. Is there an existing Command (e.g. CFX_ID_HORZGRID) for toggling the

AXIS_Y2 grid? I 've added a button to the toolbar for such a command. Do I

have to write my own command? I tried via the example in the docs but what

I've done doesn't work.

Following is the asp page contents.

Regards,

David

<%@ Language=VBScript %>

<!-- #include virtual="/Include/CfxIE.inc" -->

<% ' VI 6.0 Scripting Object Model Enabled %>

<!--#include file="_ScriptLibrary/pm.asp"-->

<% if StartPageProcessing() Then Response.End() %>

<form name="thisForm" METHOD="post">

<html>

<head>

<meta NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">

<link REL="stylesheet" TYPE="text/css"

HREF="stylesheets/SCE%20Hydran.css">

<title>Monitoring System</title>

</head>

<%

Set CBAconn = Server.CreateObject("ADODB.Connection")

CBAconn.ConnectionTimeout = Application("CBADATA_ConnectionTimeout")

CBAconn.CommandTimeout = Application("CBADATA_CommandTimeout")

CBAconn.Open Application("CBADATA_ConnectionString"), _

Application("CBADATA_RuntimeUserName"), _

Application("CBADATA_RuntimePassword")

set rstTrendData = Server.CreateObject("ADODB.Recordset")

rstTrendData.ActiveConnection = CBAconn

sqlstmt = "select ch1_value,ch2_value,ch3_value,ch4_value,ch5_value, " &_

"event_record_number from rtr008_olm_ev_data where " &_

"event_header_id = 138;"

rstTrendData.Open sqlstmt

%>

<%

Private Sub ChartFX1_UserCommand(wParam,lParam,nRes)

Response.Write "Now we're in here"

If wParam = 1 then

If nRes = 1 then

ChartFX1.Commands(1).Picture = 10

Y2Axis.Grid = 1

Else Y2Axis.Grid = 0

End If

End If

End Sub

%>

<body>

<h1> Monitoring System</h1>

<div id="NavBar">

<a HREF="default.htm">Logout</a>

<a HREF="search.htm">Search</a>

<a HREF="heartbeat.asp">Heartbeat</a>

<a HREF="monitordetails.asp">Monitor Details</a>

<br>

</div>

<br>

<%

Set ChartFX1 = Server.CreateObject("ChartFX.WebServer")

Set YAxis = ChartFX1.Axis(AXIS_Y)

Set Y2Axis = ChartFX1.Axis(AXIS_Y2)

Set XAxis = ChartFX1.Axis(AXIS_X)

'Set number of series and points per series

ChartFX1.OpenDataEx COD_VALUES,5,3232

ChartFX1.CloseData COD_VALUES

'Left Y axis settings

YAxis.AutoScale = false

YAxis.AdjustScale

YAxis.Grid = true

'Right Y axis settings

Y2Axis.AutoScale = false

Y2Axis.AdjustScale

Y2Axis.Grid = true

'X axis settings

XAxis.AutoScale = false

XAxis.AdjustScale

'Data series formating

ChartFX1.DataType(0) = CDT_VALUE

ChartFX1.DataType(1) = CDT_VALUE

ChartFX1.DataType(2) = CDT_VALUE

ChartFX1.DataType(3) = CDT_VALUE

ChartFX1.DataType(4) = CDT_VALUE

ChartFX1.DataType(5) = CDT_LABEL

ChartFX1.MarkerShape = MK_NONE

'Assign series to right Y axis

ChartFX1.Series(3).YAxis = AXIS_Y2

' General Settings

ChartFX1.Gallery = LINES

ChartFX1.Chart3D = 0

ChartFX1.Rgb2DBk = RGB(204,204,204)

ChartFX1.AllowResize = false

'Toolbar control

ChartFX1.ToolBar = true

'Add command to control Axis_Y2 grid

ChartFX1.Commands.AddCommand 1

ChartFX1.Commands(1).Style = CBIS_TWOSTATE

ChartFX1.Commands(1).Picture = 9

ChartFX1.Commands(1).Text = "Horizontal grid axis Y2"

ChartFX1.Commands(1).Enabled = true

ChartFX1.ToolBarObj.AddItems 1,9

'Assign the command id to added button

ChartFX1.ToolBarObj(9).CommandID = 1

'Remove toolbar items

ChartFX1.ToolBarObj.RemoveItems 1,0

ChartFX1.ToolBarObj.RemoveItems 4,1

ChartFX1.ToolBarObj.RemoveItems 7,5

ChartFX1.ToolBarObj.RemoveItems 4,7

'Grid settings

XAxis.Grid = True

YAxis.Grid = True

'Need to figure out toolbar button to enable/disable

'right y axis grid

'Y2Axis.Grid = True

ChartFX1.ADOResultset rstTrendData

rstTrendData.Close

'Series legend settings

'MUST come after assigning recordset to chart object

ChartFX1.SerLegBox = true

ChartFX1.SerLegBoxObj.Moveable = false

ChartFX1.Series(0).Legend = "DC Voltage"

ChartFX1.Series(1).Legend = "Circuit"

ChartFX1.Series(2).Legend = "Event"

ChartFX1.Series(3).Legend = "Current"

ChartFX1.Series(4).Legend = "Spare Ch 5"

%>

<%=ChartFX1.GetHtmlTag("100%","75%")%>

<br>

</body>

<% ' VI 6.0 Scripting Object Model Enabled %>

<% EndPageProcessing() %>

</form>

</html>

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...