HTA dynamic chart

Author Message
danteusz

  • Total Posts : 19
  • Scores: 0
  • Reward points : 0
  • Joined: 9/14/2006
  • Status: offline
HTA dynamic chart Friday, September 22, 2006 7:37 PM (permalink)
0
 <head>
 <title>SCADA</title>
 <HTA:APPLICATION ID="oHTA"
 BORDER="none"
 INNERBORDER="no"
 SHOWINTASKBAR="no"
 WINDOWSTATE="maximize"
 SCROLL="No"
 APPLICATIONNAME="HTA Verification"
 NAVIGABLE="yes">
 
 <style type="text/css">
 TD {font-size:8pt}
 input {font-size:8pt}
 H5 {font-size:8pt;}
 </style>
 </head>
 
 <BODY STYLE="font:14pt arial; color:red;
 filter:progid:DXImageTransform.Microsoft.Gradient
 (GradientType=370371, StartColorStr='#800000', EndColorStr='#DB7093')">
 
 <script language="VBscript">
 On error resume Next
 Sub ChangeIFrame
    MyFrame.Document.Body.InnerHTML="<iframe width='100%' height='100%' src='pliki/5.htm'></iframe>"
 End Sub
 
 Sub ChangeIFrame2
 MyFrame.Document.Body.InnerHTML="<object id=ChartSpace1 classid=CLSID:0002E55D-0000-0000-C000-000000000046 style='width:100%;height:350'></object>"
 
 Dim categories(3)
    Dim values(3)
    Dim chConstants
 
    ' Create an array of strings representing the categories.
  
    ' The first category has a leading tic mark - without a character
    ' of some sort in one of the category values, the chart will not display
    ' The chart object cannot handle a string in the format xx:yy
    categories(0) = "12"
    categories(1) = "13"
    categories(2) = "14"
    categories(3) = "15"
 
    ' Clear the contents of the chart workspace. This removes
    ' any old charts that may already exist and leaves the chart workspace
    ' completely empty. One chart object is then added.
    ChartSpace1.Clear
    ChartSpace1.Charts.Add
    Set chConstants = ChartSpace1.Constants
    ChartSpace1.Charts(0).Type = chConstants.chChartTypeSmoothLine
 
    ' Add one series to the chart.
    ChartSpace1.Charts(0).SeriesCollection.Add
 
    ' Series one contains sales growth data for 1998.
    ' Set the series caption (the text that appears in the legend).
    ChartSpace1.Charts(0).SeriesCollection(0).Caption = "10-Jun-1998"
 
    ' Set the categories for the first series (this collection is zero-based)
    ChartSpace1.Charts(0).SeriesCollection(0).SetData chConstants.chDimCategories, chConstants.chDataLiteral, categories
   
    values(0) = 0.2
    values(1) = 0.6
    values(2) = 0.1
    values(3) = 0.4
 
    ChartSpace1.Charts(0).SeriesCollection(0).SetData chConstants.chDimValues, chConstants.chDataLiteral, values
 
    ' Make the chart legend visible, format the left value axis as percentage,
    ' and specify that value gridlines are at 10% intervals.
    ChartSpace1.Charts(0).HasLegend = True
    ChartSpace1.Charts(0).Axes(chConstants.chAxisPositionLeft).NumberFormat = "0%"
    ChartSpace1.Charts(0).Axes(chConstants.chAxisPositionLeft).MajorUnit = 0.1
 
 End Sub
 </script>
 <table border="0" width="100%" height="100%" id="tabela">
    <tr>
        <td height="37">
 <Input ID="Close" ACCESSKEY="C" onclick="ChangeIFrame2()" type="button" value="Graph">
 <Input ID="Close" ACCESSKEY="C" onclick="self.close()" type="button" value="Close">
 --== SCADA 2006 K&K Kapica Karpiak Technika Grzewcza i Sanitarna ==--
 
   <hr />
 </td>
    </tr>
    <tr>
        <td>
 <iframe id=MyFrame  width="100%" height="100%" onload="ChangeIFrame"></iframe>
 </td>
    </tr>
 </table>
 



It's look like this i would like to have a chart when i press on button but I have got only error message :
There is no ChartSpace1, any ideas how to solve that think?

I know that i can put:
<object id=ChartSpace1 classid=CLSID:0002E55D-0000-0000-C000-000000000046 style="width:100%;height:350"></object>

in body of table and it's works, but i want to have graph only when i press the button.

 
 
//EDIT: added code TAGS
<message edited by Snipah on Friday, September 22, 2006 8:39 PM>
 
#1
    Snipah

    • Total Posts : 1339
    • Scores: 8
    • Reward points : 0
    • Joined: 11/1/2004
    • Location: Scotland
    • Status: offline
    RE: HTA dynamic chart Friday, September 22, 2006 9:09 PM (permalink)
    0
    Hiya,

    Your problem is not the VBScript, it is design related (HTML).

    Place the original IFrame in side a DIV, call that IFrame at onLoad, then when switching to the graph, remove the IFrame, and load the OBJECT inside the DIV.

     [...]
     Sub ChangeIFrame()
     document.getElementByID("myDiv").InnerHTML="<iframe width='100%' height='100%' src='pliki/5.htm'></iframe>"
     End Sub
     
     
     Sub ChangeIFrame2()
     document.getElementByID("myDiv").InnerHTML="<object id='ChartSpace1' classid='CLSID:0002E55D-0000-0000-C000-000000000046' style='width:100%;height:350'></object>"
     [...]
     End Sub
     [...]
     <body>
     [...]
     <div id="myDiv"></div>
     
    For more information, please see the "Read me First" topic.

    http://www.visualbasicscript.com
     
    #2
      danteusz

      • Total Posts : 19
      • Scores: 0
      • Reward points : 0
      • Joined: 9/14/2006
      • Status: offline
      RE: HTA dynamic chart Saturday, September 23, 2006 12:44 AM (permalink)
      0
      Nice man,
      u are my god,
      i wasted 2 days and nothing ... really thx

       
      #3

        Online Bookmarks Sharing: Share/Bookmark

        Jump to:

        Current active users

        There are 0 members and 1 guests.

        Icon Legend and Permission

        • New Messages
        • No New Messages
        • Hot Topic w/ New Messages
        • Hot Topic w/o New Messages
        • Locked w/ New Messages
        • Locked w/o New Messages
        • Read Message
        • Post New Thread
        • Reply to message
        • Post New Poll
        • Submit Vote
        • Post reward post
        • Delete my own posts
        • Delete my own threads
        • Rate post

        2000-2012 ASPPlayground.NET Forum Version 3.9