Skip to content

Instantly share code, notes, and snippets.

@skarred
Last active December 25, 2015 04:19
Show Gist options
  • Save skarred/6916052 to your computer and use it in GitHub Desktop.
Save skarred/6916052 to your computer and use it in GitHub Desktop.
YUI3 WordPress Plugin Example: Using the [yuichart] shortcode to generate a scatter plot on a WP page or post.

A Scatter Plot

The following WP shorcode...

[yuichart
    title = 'Ice Cream Sales vs Temperature °F'
	filename = 'scatter.csv'
	type = 'marker'
	categorytype = 'numeric'
	cataxtitle = 'Temperature'
	alwaysShowZero = 0
	catmin = 50
	catmax = 120
	catdecimalplaces = 0
	catlabelrotation = '-90'
	catlabelsuffix = ' °F'
	vax1min = 110
	vax1max = 420
	vax1title='Ice Cream Sales'
	vax1labelrotation = '0'
	vax1prefix = '\$'
	vax1decimalplaces = 2 
	showlines = 0 
	showmarkers = 1
	showareafill = 0 
	showlegend = 1
	hgridlines = 1
	vgridlines = 1
]

and the data file scatter.csv (below) will render the following chart:

Pie Chart

Temperature Sales
62 143
67 224
68 237
69 193
70 208
71 200
75 209
75 276
77 278
79 231
83 258
89 257
91 328
92 233
92 296
92 320
92 327
93 339
96 312
96 355
97 278
98 274
98 324
99 326
99 332
100 356
100 378
102 287
103 286
104 309
105 369
105 370
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment