Including Graphs: Difference between revisions

From National Gallery Research Wiki
Jump to navigation Jump to search
No edit summary
Line 1: Line 1:
Graphs produced using the [http://danvk.org/dygraphs/ Dygraph] javascript library.
Graphs produced using the [http://danvk.org/dygraphs/ Dygraph] javascript library.


== Widget ==
== DyGraph Extension ==
Graphs can be constructed by adding data and annotations to the widget as formatted text.
* [[Widget:dyGraph]]


== Template ==
In order to make it easier to include DyGraph graphs within wiki pages a specific extension has been written. Further information will be provided once this new extension has been properly tested.
By using this template data and annotations can now be uploaded to the wiki as separate files and then added to a graph, see:
 
* [[Template:dyGraph]]
A graph can be added to a page by included a version of the syntax shown below.
 
'''Please note:'''
* It is only possible to provide one set of annotations, either as local data or as a file.
* It is not possible to use a combination of internal and external data files.
* Local data files including a "," in the names will not work properly.
 
=== From Local Data ===
<pre>
{{#dygraph:
data=Wavelength, Reflectance(%)
xv1, y1v1
xv2, y1v2
xv3, y1v3
xv4, y1v4
...|
wid=Width in Pixels|
hei=Width in Pixels|
title=Graph Title|
xtitle=XTitle|
ytitle=YTitle|
ann=[
["Series No, Y-value, 'Tag', 'Title', width],
["Series No, Y-value, 'Tag', 'Title', width],
...
]
}}
</pre>
 
===From Text Files===
<pre>
{{#dygraph:
files=data1.txt|
wid=600px|
hei=500px|
title=Graph Title|
xtitle=XTitle|
ytitle=YTitle|
annfile=annotation1.txt
}}</pre>
 
===From External Files===
<pre>
{{#dygraph:
files=http://mysourceofdata.com?id=1|
wid=600px|
hei=500px|
title=Graph Title|
xtitle=XTitle|
ytitle=YTitle|
}}</pre>


== Examples ==
== Examples ==
Line 13: Line 61:
* [[Example Graph 2]]: Reflectance spectra for French ultramarine (362 data points)
* [[Example Graph 2]]: Reflectance spectra for French ultramarine (362 data points)
* [[Example Graph 3]]: Annotate gas chromatogram (10K data points)
* [[Example Graph 3]]: Annotate gas chromatogram (10K data points)
* [[Example Graph 4]]: Including a graph of data from an external source
* [[Example Graph 4]]: Large data set of environmental readings (20K x 3 data points)
* [[Example Graph 5]]: An FTIR spectrum with a reversed X-axis
* [[Example Graph 5]]: An FTIR spectrum with a reversed X-axis


[[Category:Test page]]
[[Category:Test page]]
[[Category:Example page]]
[[Category:Example page]]
[[Category:DyGraph]]

Revision as of 18:17, 2 May 2012

Graphs produced using the Dygraph javascript library.

DyGraph Extension

In order to make it easier to include DyGraph graphs within wiki pages a specific extension has been written. Further information will be provided once this new extension has been properly tested.

A graph can be added to a page by included a version of the syntax shown below.

Please note:

  • It is only possible to provide one set of annotations, either as local data or as a file.
  • It is not possible to use a combination of internal and external data files.
  • Local data files including a "," in the names will not work properly.

From Local Data

{{#dygraph:
data=Wavelength, Reflectance(%)
xv1, y1v1
xv2, y1v2
xv3, y1v3
xv4, y1v4
...|
wid=Width in Pixels|
hei=Width in Pixels|
title=Graph Title|
xtitle=XTitle|
ytitle=YTitle|
ann=[
["Series No, Y-value, 'Tag', 'Title', width],
["Series No, Y-value, 'Tag', 'Title', width],
...
]
}}

From Text Files

{{#dygraph:
files=data1.txt|
wid=600px|
hei=500px|
title=Graph Title|
xtitle=XTitle|
ytitle=YTitle|
annfile=annotation1.txt
}}

From External Files

{{#dygraph:
files=http://mysourceofdata.com?id=1|
wid=600px|
hei=500px|
title=Graph Title|
xtitle=XTitle|
ytitle=YTitle|
}}

Examples