Jump to content
Software FX Community

Dual Y-Axis

User (Legacy)

Recommended Posts

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


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.



<%@ 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">



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

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


<title>Monitoring System</title>



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

CBAconn.ConnectionTimeout = Application("CBADATA_ConnectionTimeout")

CBAconn.CommandTimeout = Application("CBADATA_CommandTimeout")

CBAconn.Open Application("CBADATA_ConnectionString"), _

Application("CBADATA_RuntimeUserName"), _


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



<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>





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.Grid = true

'Right Y axis settings

Y2Axis.AutoScale = false


Y2Axis.Grid = true

'X axis settings

XAxis.AutoScale = false


'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


'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"





<% ' VI 6.0 Scripting Object Model Enabled %>

<% EndPageProcessing() %>



Link to comment
Share on other sites


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

  • Create New...