0

I'm trying to create a JIRA gadget that uses highcharts and I'm not being able to call in the javascript highcharts.js correctly.

The file is located at: atlassian_tutorial-jira-gadget/src/main/resources/js/HighStock/highcharts.js

The atlassian-plugin.xml has the following added to it:

<web-resource key="highstock">
  <resource type="download" name = "highcharts.js" location = "js/HighStock/highcharts.js">
     <property key = 'content-type' value = 'text/javascript' />
  </resource>
</web-resource>

The gadget file gadget.xml has the following:

#requireResource("plugin-key:highstock")

...
<div id = "container">HighStock</div>

... 

AJS.$('#container').highcharts('StockChart',{title:{text:'Test'}});

Nothing happens at all. And I get the following error in Google Chrome console:

Uncaught TypeError: Object [object Object] has no method 'highcharts'

codeBarer
  • 2,238
  • 7
  • 44
  • 75

1 Answers1

0
  1. Check that you're even including jQuery AUI in your gadget
  2. Check that you've referenced HighCharts correctly

Get the URL of the rendered gadget XML and check that you are correctly calling jQuery via something like #requireResource("com.atlassian.gadgets:common-resources") and HighCharts in the XML file. If you spot any problems, update atlassian-plugin.xml with the corrected paths

More on Using Web Resources in your Gadget.

Edit: If your Javascript file is located at /main/src/resources/js/HighStock/highcharts.js then this snippet of atlassian-plugin.xml should work:

<web-resource key="highstock">
  <resource type="download" name="highcharts.js" location="/js/HighStock/highcharts.js" />
</web-resource>

Note that I've removed the spaces in the attribute = "value" bits that you originally had; also prefixed the location attribute value with a /

dvdsmpsn
  • 2,839
  • 1
  • 26
  • 40
  • I checked everything accordingly and it still doesn't pull highcharts.js Is there a specific way the paths need to be set? – codeBarer Aug 07 '13 at 20:29
  • where should I be storing the javascript files? Right now it is in the ./main/resources/js but it doesn't seem to find it – codeBarer Aug 07 '13 at 22:14
  • I tried everything I could and I think I am having issues on how to call #requireResource(). Perhaps sharing code will be easier. In gadget dot xml I'm trying to call Foo. The file is located in resource/js/test.js https://www.dropbox.com/sh/ngyawg7gl507bq8/gmv5eCr8QR – codeBarer Aug 09 '13 at 18:30