Template:DyGraph

From National Gallery Research Wiki
Revision as of 17:54, 17 June 2011 by Jpadfield (talk | contribs) (Created page with "<noinclude>__NOTOC__ This widget allows you to convert a simple uploaded list of comma separated values into a graph using the Widget:dyGraph. {|cellpadding="10" cellspacin...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This widget allows you to convert a simple uploaded list of comma separated values into a graph using the Widget:dyGraph.

Template Example

Prepare your data in a simple text file as follows:

Xtitle, Ytitle
380, 21.340902
382, 33.233604
384, 21.972370
386, 24.424133
388, 24.515604
390, 25.614174
392, 22.461115
394, 27.229023
396, 24.665756
398, 26.529636
400, 26.045645
402, 28.149729
....

Prepare your annotations in a simple text file as follows:

  • [data series no, y-value, short text, long text, short text display width]


[
[1, 14.952, 'Sub', 'Methyl suberate', 50],
[1, 16.204, 'A', 'Methyl azalate', 50],
[1, 20.241, 'P', 'Methyl palmitate', 50],
[1, 22.157, 'S', 'Methyl stearate', 50],
....
]
  • Save your data text file with an appropriate name: mydata.txt
  • Save your annotation text file with an appropriate name: mydata_annotations.txt
  • Upload both files to the wiki using, Special:Upload
  • You can now add a simple graph of data included in your file to any page using the following:
 {{Template:dyGraph|
  {{filepath:mydata.txt}}|
  graphName|
  width|
  height|
  title|
  xtitle|
  ytitle|
  {{filepath:mydata_annotations.txt}}}}

As an example the files File:M1382s4 rep GCMS 140211.txt and File:M1382s4 rep GCMS 140211 Annotations.txt have already been uploaded and the graph can be produced using:

 {{Template:dyGraph|
  data={{filepath:M1382s4_rep_GCMS_140211.txt}}|
  div=graph1|
  wid=400px|
  hei=300px|
  title=Example Graph|
  xtitle=Wavenumber|
  ytitle=Intensity|
  ann={{filepath:M1382s4_rep_GCMS_140211_Annotations.txt}}
 }}


{{#widget:dyGraph| data=https://research.nationalgallery.org.uk/wiki/ng/images/0/0c/M1382s4_rep_GCMS_140211.txt%7C div=graph1| wid=800px| hei=500px| title=Example Graph| xtitle=Wavenumber| ytitle=Intensity| ann=https://research.nationalgallery.org.uk/wiki/ng/images/6/6d/M1382s4_rep_GCMS_140211_Annotations.txt }}