It's a very basic demo but here is one that works for me.

I avoided the whole path problem by loading d3 from a cdn. I don't
know if you have a requirement that it be local but I assume it
wouldn't be that much to change.

https://gist.github.com/joebo/591f52147dfe02efa061

Each time you click the button it will make the first circle larger

Of course it could get fancier in the future by using ajax

I saved it in my temp path and then ran
load jpath '~temp/d3demo.ijs

After staring jhs

coclass'd3demo'
coinsert'jhs'

body =: 0 : 0
<script src="//cdnjs.cloudflare.com/ajax/libs/d3/3.3.13/d3.min.js"></script>
<script>
function draw(size) {

//initial load
if (size == undefined) {
return
}

 var svg = d3.select("body").append("svg");
 var dataSet = [10*size, 20, 30, 40];

 var circle = svg.selectAll('circle')
     .data(dataSet)
     .enter()
     .append('circle')
     .attr({
         r:function(d){ return d },
         cx:function(d, i){ return i * 100 + 50 },
         cy:50,
         fill: 'red'
     });
}
</script>
)
HBS=: 0 : 0
body
'btn'   jhb  'click me'
'<script>draw(<RESULT>)</script>'
)


create=: 3 : 0
'd3demo'jhr'RESULT';y NB. <RESULT> tag replaced by y
)

jev_get=: create

size=:1

ev_btn_click=: 3 : 0
size=:size+1
create size
)

CSS=: ''   NB. styles

JS=: 0 : 0 NB. javascript
function ev_btn_click(){jsubmit();}
)


On Sat, Jan 11, 2014 at 9:06 PM, Brian Schott <schott.br...@gmail.com> wrote:
> I am really wanting to write a jhs page to create a standalone opengl_es
> demo. I am using the d3 demo written by the Tirrells to see how. I am
> stumped right now with defining a directory which will hold all the
> javascript scripts and the css style files, for example. The <base> tag
> seems like a natural way to do so, but I cannot put that together with JHS.
>
> Thanks for the offer.
>
>
>
> On Sat, Jan 11, 2014 at 8:49 PM, Joe Bogner <joebog...@gmail.com> wrote:
>
>> I don't fully understand the issue after reading through the thread a
>> few times.I did run the d3 demo successfully under j8
>>
>> I followed the readme.md instructions and didn't modify anything
>>
>> load 'graphics/d3'
>> d3heatmap makesampledata_d3heatmap_''
>>
>> It shows a map of the US. Likewise, the other demos work for me too.
>>
>> In terms of the html409 error, I commonly get that when I launch jhs.
>> It doesn't seem to impact anything
>>
>> Is the question how to build a standalone jhs page to do a simple d3
>> demo? If so, I can try to help with that.
>>
>>
>>
>> --
> (B=)
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to