Home Forums Chart Support HTA Help. Graph does not match up when printed Reply To: HTA Help. Graph does not match up when printed

#9726

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 8 years, 4 months ago by codymbecker.