Jump to content

Chart activex help


bavella
 Share

Recommended Posts

I'm struggling for days to make a Charting Activex tool work with Autoit.

csxGraph is a nice tool able to draw XY plots.

Here's the code I'm using (without success) :

; script to test the csXGraph ACTIVEX Control (from ChestySoft)
; http://www.chestysoft.com/xgraph/default.asp)

#include <GUIConstants.au3>

$oControl = ObjCreate ("csXGraphTrial.Draw")

If @error then
    Msgbox (1,"debug","ObjCreate Failed")
    Exit
Endif

$Form1 = GUICreate ("csXGraph Test", 633, 443, 193, 115)
$Button1 = GUICtrlCreateButton ("Draw", 24, 56, 121, 41, 0)
$Button2 = GUICtrlCreateButton ("Quit", 24, 320, 121, 41, 0)

$GUIActivex = GUICtrlCreateObj($oControl, 184, 56, 400, 300)

$oControl.ClearData
$oControl.ShowGrid = True
$oControl.GraphType = 0

GUISetState(@SW_SHOW)

While 1
    $msg = GuiGetMsg()
    
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop

    Case $msg = $Button1
        $oControl.Drawgraph ()

    Case $msg = $Button2
        ExitLoop
    EndSelect
WEnd
Exit

This script fails to display the Chart when the Draw button is clicked.

If anybody has an idea...

I tried with RMChart tool as well without any better success. Damned !

I'm using the last Beta of Autoit.

many thanks,

Bavella

Link to comment
Share on other sites

  • 1 month later...

If you're looking at charting apps , I have used the simplechart implementation w/ au3 successfully, IIRC. They used to have a (watermarked ) full demo version available for download -- haven't touched it since au3 was in early beta.

Reading the help file before you post... Not only will it make you look smarter, it will make you smarter.

Link to comment
Share on other sites

Some ActiveX controls just need a little extra somethin' somethin'. ;)

Here's a working example:

; script to test the csXGraph ACTIVEX Control (from ChestySoft)
; http://www.chestysoft.com/xgraph/default.asp)

#include <GUIConstants.au3>

$oControl = ObjCreate ("csXGraphTrial.Draw")

If @error then
    Msgbox (1,"debug","ObjCreate Failed")
    Exit
Endif

$Form1 = GUICreate ("csXGraph Test", 633, 443, 193, 115)
$Button1 = GUICtrlCreateButton ("Draw", 24, 56, 121, 41, 0)
$Button2 = GUICtrlCreateButton ("Quit", 24, 320, 121, 41, 0)

$GUIActivex = GUICtrlCreateObj($oControl, 184, 56, 400, 300)

$oControl.ClearData
$oControl.ShowGrid = True
$oControl.YAxisText = "Y Axis"
$oControl.XAxisText = "X Axis"
$oControl.AxisTextFont.Bold = True
$oControl.AddPoint(0, 0, 120, "Red Line")
$oControl.AddPoint(30, 30, 120, "")
$oControl.AddPoint(0, 0, 230, "Green Line")
$oControl.AddPoint(30, 20, 230, "")
$oControl.GraphType = 3

GUISetState(@SW_SHOW)

While 1
    $msg = GuiGetMsg()
    
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop

    Case $msg = $Button1
        $oControl.DrawGraph

    Case $msg = $Button2
        ExitLoop
    EndSelect
WEnd
Exit

Good luck!

-S

(Yet Another) ExcelCOM UDF"A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly...[indent]...specialization is for insects." - R. A. Heinlein[/indent]
Link to comment
Share on other sites

By the by, if you want to work with the most powerful chart objects ever made, you might consider using the Chart objects that are a part of Office Web Components. OWC is installed as part of Office/Outlook and can be downloaded separately (i.e. if you're not using Office) for free.

The documentation for it is excellent, too. The compiled help file is OWCDCH11.CHM (for Office 2003) and it will tell you everything you need to know about using this set of objects. You'll find the "programming information" section particularly applicable. Unfortunately, the objects take time to learn how to use, and require a lot of object-specific constants that you'll have to cross-reference when setting properties or calling methods.

Perhaps this would be a good UDF library to write one of these days. Hmm.

Here's a working example:

;OWC11 Chart Test

#include <GUIConstants.au3>

$oControl = ObjCreate ("OWC11.ChartSpace")  ; If you're using Office XP use OWC10.ChartSpace, Office 2000 use OWC9.ChartSpace

If NOT IsObj($oControl) Then
    Msgbox (1,"debug","ObjCreate Failed")
    Exit
Endif

$Form1 = GUICreate ("OWC11 Chart Test", 633, 443, 193, 115)
$Button1 = GUICtrlCreateButton ("Draw", 24, 56, 121, 41, 0)
$Button2 = GUICtrlCreateButton ("Quit", 24, 320, 121, 41, 0)

; Set up the chart control
$oChart1 = $oControl.Charts.Add
$oChart1.Type = 1
$oChart1.SetData(0, -1, "Series Name")
$oChart1.SetData(1, -1, "A, B, C, D, E, F")
$oChart1.SeriesCollection(0).SetData(2, -1, "10, 9, 8, 7, 6, 5")

GUISetState(@SW_SHOW)

While 1
    $msg = GuiGetMsg()
    
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop

    Case $msg = $Button1
        $GUIActivex = GUICtrlCreateObj($oControl, 184, 56, 400, 300)

    Case $msg = $Button2
        ExitLoop
    EndSelect
WEnd
Exit

If you don't have the Office Web Components, you can download a set here:

http://www.microsoft.com/downloads/details...;displaylang=en

I think you're armed to the teeth with good info now.

-S

Edited by Locodarwin
(Yet Another) ExcelCOM UDF"A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly...[indent]...specialization is for insects." - R. A. Heinlein[/indent]
Link to comment
Share on other sites

  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...