ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  XYChart crate a runtime inside the panel
Posted by Peter on Jan-24-2025 23:11
I create a panel at runtime in a formS create at runtime.
I need to insert an XYChart inside the panel, how can I do it?
this is my code

Dim Pan As New Panel
Pan.Name = "Pan" & nFormChildId    '(Is identity Numeric Form)
Pan.Size = New Size(500, 5000)
FChild.Controls.Add(Pan)


dim c as new XYChart(200,200)

c.name = "Chart" & nFormChildId          IS NOT POSSIBLE

Pan.Controls.Add(c)                             ERROR NOT CONVERT IN CONTROL

  Re: XYChart crate a runtime inside the panel
Posted by Peter Kwan on Jan-27-2025 00:34
Hi Peter,

You can only put controls in a Panel. XYChart is not a control, it is the content. The control is WinChartViewer. So the code is:

' Put a control in the Pabel
Dim viewer As New WinChartViewer
Pan.Controls.Add(c)

' Put a test chart into the control so you can see it
Dim testChart as new XYChart(200, 200, &HFFFF00)
testChart.addTitle("Test Chart")
viewer.Chart = testChart


The relationship between the WinChartViewer control and the XYChart is analogous to the relationship between a Label control and a text String. The Panel needs to contain the "control" (WinChartViewer or Label), and the content (XYChart or String) is assigned to the control.

Best Regards
Peter Kwan

  Re: XYChart crate a runtime inside the panel
Posted by Peter on Jan-27-2025 15:00
thank you so much.
i'll do some test