NetTalk Central

Author Topic: Insert variable into XHTML code  (Read 3250 times)

kingja

  • Sr. Member
  • ****
  • Posts: 261
    • View Profile
    • Email
Insert variable into XHTML code
« on: April 15, 2015, 11:15:45 AM »
     I have some XHTML code as follows:

<h1>Sample Study Stats Graph</h1>

    <canvas id="cvs1" width="500" height="250">[No canvas support]</canvas>
   
    <script>
        $(document).ready(function ()
        {
            var bar = new RGraph.Bar({
                id: 'cvs1',
                data: [[100,5,3],[4,8,6],[4,2,4],[4,2,3],[1,2,3],[8,8,4],[4,8,6]],
                options: {
                    labels: {
                        self: ['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'],
                        above: true
                    },
                    colors: ['red','yellow', 'pink'],
                    bevel: !RGraph.ISOLD,
                    grouping: 'stacked',
                    strokestyle: 'rgba(0,0,0,0)'
                }               
            }).draw()
        })
    </script>

Notice the line starting with data:, I want to fill this line with a local variable that has been pre-set.  The variable is inst1_pre.   I have changed the data: line to read the following:

 data: <!-- Net:s:inst1_pre -->,

This does not work.  How can I insert the NT variable into this XHTML code?  Using NT 8.41, C9.1.11529.

Thanks,

Jeff King

kingja

  • Sr. Member
  • ****
  • Posts: 261
    • View Profile
    • Email
Resolved - Re: Insert variable into XHTML code
« Reply #1 on: April 15, 2015, 11:34:40 AM »
I was setting a variable on the data pad with an initial value.  I changed this to embed code at the top of the procedure:

p_web.SSV('ChartData', '[[100,5,3],[4,5,3],[4,5,3],[4,5,3],[4,5,3],[4,5,3],[4,5,3]],')

I then set the data: line with <!-- Net:s:ChartData -->

Works great!

Jeff