Quinn-Curtis Forums
Quinn-Curtis Forums
Home | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Tools for Microsoft .Net
 Real-Time Graphics Tools for .Net (VB and C#)
 Confusion about axes, grids, coords, everything!

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkInsert EmailInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
   

T O P I C    R E V I E W
soundar Posted - 04 Feb 2008 : 07:42:06
When I run the following code, I see 2 different y axis labes for the same dataset (rptccraw_) and 2 y axis grids! I cannot figure this out.


The user control code (scrollinggraph)
----------------
Imports com.quinncurtis.chart2dnet
Imports com.quinncurtis.rtgraphnet
Imports System.Drawing
Imports System.Drawing.Drawing2D
Public Class ScrollingGraph
Private scrollFrame As New RTScrollFrame()
Private rtpCcRaw_ As RTProcessVar
Private ccColor_ As Color = Color.DarkCyan

Private font8 As New Font("Microsoft Sans Serif", 8, FontStyle.Regular)
Private Sub ScrollingGraph_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
InitializeGraph()
End Sub
Public Sub InitializeGraph()
rtpCcRaw_ = New RTProcessVar()
rtpCcRaw_.MinimumValue = 5000000.0
rtpCcRaw_.MaximumValue = 7000000.0
rtpCcRaw_.DatasetEnableUpdate = True



InitializeScrollGraph()
End Sub
Private Sub InitializeScrollGraph()
Dim startTime As New ChartCalendar()
Dim endTime As New ChartCalendar()
Dim chartVu As ChartView = Me


endTime.Add(ChartCalendar.SECOND, 60)

Dim ccTransform As New TimeCoordinates(startTime, -2000, endTime, 2000)

Dim xaxis As New TimeAxis(ccTransform, ChartObj.X_AXIS)
chartVu.AddChartObject(xaxis)
Dim xAxisLab As New TimeAxisLabels(xaxis)
chartVu.AddChartObject(xAxisLab)

Dim ccYaxis As New LinearAxis(ccTransform, ChartObj.Y_AXIS)
ccYaxis.LineColor = ccColor_
chartVu.AddChartObject(ccYaxis)

Dim ccAxisLab As New NumericAxisLabels(ccYaxis)
ccAxisLab.TextFont = font8
ccAxisLab.SetColor(ccColor_)
chartVu.AddChartObject(ccAxisLab)

Dim ccAxisGrid As New Grid(xaxis, ccYaxis, ChartObj.Y_AXIS, ChartObj.GRID_MAJOR)
ccAxisGrid.SetColor(Color.White)
ccAxisGrid.SetLineWidth(1)
ccAxisGrid.SetLineStyle(DashStyle.Dot)
chartVu.AddChartObject(ccAxisGrid)





Dim graphbackground As New Background(ccTransform, ChartObj.GRAPH_BACKGROUND, Color.White)
chartVu.AddChartObject(graphbackground)

Dim plotbackground As New Background(ccTransform, ChartObj.PLOT_BACKGROUND, Color.Black)
chartVu.AddChartObject(plotbackground)



Dim xAxisGrid As New Grid(xaxis, ccYaxis, ChartObj.X_AXIS, ChartObj.GRID_MAJOR)
xAxisGrid.SetColor(Color.White)
xAxisGrid.SetLineWidth(1)
xAxisGrid.SetLineStyle(DashStyle.Dot)
chartVu.AddChartObject(xAxisGrid)


scrollFrame = New RTScrollFrame(Me, rtpCcRaw_, ccTransform, _
ChartObj.RT_FIXEDEXTENT_MOVINGSTART_AUTOSCROLL, ChartObj.RT_AUTOSCALE_Y_MINMAX)
scrollFrame.MinSamplesForAutoScale = 10
scrollFrame.ScrollRescaleMargin = 0.05

chartVu.AddChartObject(scrollFrame)

Dim attrib1 As New ChartAttribute(ccColor_, 1, DashStyle.Solid)
Dim lineplot1 As New SimpleLinePlot(ccTransform, Nothing, attrib1)
lineplot1.SetFastClipMode(ChartObj.FASTCLIP_X)
Dim ccPLot As New RTSimpleSingleValuePlot(ccTransform, lineplot1, rtpCcRaw_)
chartVu.AddChartObject(ccPLot)

End Sub
Public Sub UpdateData(ByVal cc As Long)
Dim tod As New ChartCalendar
rtpCcRaw_.SetCurrentValue(tod, cc)
End Sub
Public Sub RepaintGraph()
Me.UpdateDraw()
End Sub
End Class
--------------

form1 code that updates the data
---------------
Imports com.quinncurtis.chart2dnet
Imports com.quinncurtis.rtgraphnet
Public Class frmDriftGraphs
Dim rnd As New Random
Private Sub frmDriftGraphs_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Timer1.Enabled = True
Timer1.Interval = 100
End Sub

Private Sub ScrollingGraph1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ScrollingGraph1.Load
ScrollingGraph1.InitializeGraph()
End Sub


Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
ScrollingGraph1.RepaintGraph()
End Sub

Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick

ScrollingGraph1.UpdateData(100 * rnd.NextDouble())
End Sub
End Class
1   L A T E S T    R E P L I E S    (Newest First)
quinncurtis Posted - 04 Feb 2008 : 09:53:07
Here are couple of basic errors we found in your program.

1. The doubling of the axes must be because you are creating them twice. Placing a simple breakpoint in your InitializeScrollGraph method, we see that it is being called TWICE. It is called from the ScrollGraph.ScrollingGraph_Load method, and from the frmDriftGraphs.ScrollingGraph1_Load method. This causes every object in the graph to be created twice, including the axes. We don't know when you want to call it, be we commented out the call from frmDriftGraphs.ScrollingGraph1_Load method and it seemed to work find

2. You stated over the phone that you want a FIXED y-axis. You have the RTScrollFrame setup for a auto-scaling y-axis.

scrollFrame = New RTScrollFrame(Me, rtpCcRaw_, ccTransform, _
ChartObj.RT_FIXEDEXTENT_MOVINGSTART_AUTOSCROLL, ChartObj.RT_AUTOSCALE_Y_MINMAX)

So you need to change the last parameter to RT_NO_AUTOSCALE_Y.


scrollFrame = New RTScrollFrame(Me, rtpCcRaw_, ccTransform, _
ChartObj.RT_FIXEDEXTENT_MOVINGSTART_AUTOSCROLL, ChartObj.RT_NO_AUTOSCALE_Y)


Quinn-Curtis Forums © 2000-2018 Quinn-Curtis, Inc. Go To Top Of Page
Powered By: Snitz Forums 2000 Version 3.4.07