Home forums Using CanvasJS HTA Help. Graph does not match up when printed

Tagged: ,

This topic contains 1 reply, has 1 voice, and was last updated by  codymbecker 11 months, 2 weeks ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #9725

    codymbecker
    Member

    Hi all,

    This script is amazing! I love how simple yet diverse it is.

    I am using this script to generate graphs for a local database I am building. The database uses HTA windows to display the data (and graph) however when I got to print the page the graph does not match up. It appears that the lines on a line graph are higher than they should be.

    #9726

    codymbecker
    Member

    Here’s my HTA code. **I don’t need help/comments on my coding, unless it will fix the graph and data placement issue.

    <HTA:APPLICATION 
     APPLICATION ID="PRINT"
     applicationname="PRINT"
     border="thin" 
     borderStyle="sunken" 
     caption="yes" 
     icon="print.ico" 
     maximizeButton="No" 
     minimizeButton="No"
     SysMenu="no"
     showInTaskbar="Yes" 
     innerBorder="no"
     navigable="yes"
     scroll="yes"
     version="1.0" 
     contextmenu="no"
     selection="no"
     scrollFlat="yes"
     SINGLEINSTANCE="yes"
    />
    <title>PRINTING</title>
    <script language='VBScript'>
    Const HKEY_CURRENT_USER = &H80000001
    strComputer = "."
    Set objRegistry = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
    Set wsh = CreateObject("WScript.Shell")
    
        WindowW = 780
        WindowH = 800
        window.resizeTo WindowW, WindowH
        WindowLeft = (window.screen.availWidth - WindowW) * .5 
        WindowTop  = (window.screen.availHeight - WindowH) * .5
        window.moveTo WindowLeft, WindowTop
    
    Sub Window_onLoad
    strKeyPath = "Software\Microsoft\Internet Explorer\PageSetup"
    strValueName = "footer"
    strValue = "&bJOINT BASE PEARL HARBOR-HICKAM, HI   |   PRINTED: &d AT &t&b"
    objRegistry.SetStringValue HKEY_CURRENT_USER, strKeyPath, strValueName, strValue
    strKeyPath = "Software\Microsoft\Internet Explorer\PageSetup"
    strValueName = "header"
    strValue = "&bLAW ENFORCEMENT SENSITIVE&b"
    objRegistry.SetStringValue HKEY_CURRENT_USER, strKeyPath, strValueName, strValue
    
    'window.print()
    
    strKeyPath = "Software\Microsoft\Internet Explorer\PageSetup"
    strValueName = "footer"
    strValue = "&u&b&d"
    objRegistry.SetStringValue HKEY_CURRENT_USER, strKeyPath, strValueName, strValue
    strKeyPath = "Software\Microsoft\Internet Explorer\PageSetup"
    strValueName = "header"
    strValue = "&w&bPage &p of &P"
    objRegistry.SetStringValue HKEY_CURRENT_USER, strKeyPath, strValueName, strValue
    'self.close()
    END SUB
    </script>
    
      <script type="text/javascript">
    window.onload = function () {
        var chart = new CanvasJS.Chart("chartContainer",
        {
          theme: "theme2",
          title:{
            text: "Gate Runners - Hickam Cantonment"
          },
    
          animationEnabled: false,
    
          axisX: {
            valueFormatString: "MMM YY",
            interval:1,
            intervalType: "month"
            
          },
          axisY:{
            includeZero: false,
            interval:1
            
          },
          data: [
          {        
            type: "line",
            dataPoints: [
            { x: new Date(2012, 00, 1), y: 4 },
            { x: new Date(2012, 01, 1), y: 2 },
            { x: new Date(2012, 02, 1), y: 0 },
            { x: new Date(2012, 03, 1), y: 0 },
            { x: new Date(2012, 04, 1), y: 1 },
            { x: new Date(2012, 05, 1), y: 5 }        
            ]
          }
          
          
          ]
        });
    
    chart.render();
    
        var chart2 = new CanvasJS.Chart("chartContainer2",
        {
          theme: "theme2",
          title:{
            text: "Gate Runners - Pearl Harbor Cantonment"
          },
    
          animationEnabled: false,
    
          axisX: {
            valueFormatString: "MMM YY",
            interval:1,
            intervalType: "month"
            
          },
          axisY:{
            includeZero: false,
            interval:1
            
          },
          data: [
          {        
            type: "line",
            dataPoints: [
            { x: new Date(2012, 00, 1), y: 4 },
            { x: new Date(2012, 01, 1), y: 2 },
            { x: new Date(2012, 02, 1), y: 0 },
            { x: new Date(2012, 03, 1), y: 0 },
            { x: new Date(2012, 04, 1), y: 1 },
            { x: new Date(2012, 05, 1), y: 5 }        
            ]
          }
          
          
          ]
        });
    
    chart2.render();
    
    }
    </script>
    <script type="text/javascript" src="canvasjs.min.js"></script>
    
    <body>
    <div align="center" style="width: 100%">
      <div id="chartContainer" style="height: 300px; width: 600px;"></div>
    </div>
    <br>
    <div align="center" style="width: 100%">
      <div id="chartContainer2" style="height: 300px; width: 600px;"></div>
    </div>
    </body>
    • This reply was modified 11 months, 2 weeks ago by  codymbecker.
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.