Skip to content

Commit dfbfb97

Browse files
committed
Change axis API from xAxis, yAxis to x and y.
Taking advantage of the major bump to 2.0.0 to also make changes in the API.
1 parent 9224a99 commit dfbfb97

10 files changed

+138
-145
lines changed

site/js/site.js

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ function onSiteDependenciesLoaded() {
66

77
functionPlot({
88
target: '#description-sample',
9-
yAxis: { domain: [-1, 9] },
9+
y: { domain: [-1, 9] },
1010
tip: {
1111
renderer: function () {}
1212
},
@@ -24,8 +24,8 @@ function onSiteDependenciesLoaded() {
2424

2525
functionPlot({
2626
target: '#description-sin-exp-x-naive',
27-
yAxis: { domain: [-4, 4] },
28-
xAxis: { domain: [-2, 6] },
27+
y: { domain: [-4, 4] },
28+
x: { domain: [-2, 6] },
2929
tip: {
3030
renderer: function () {}
3131
},
@@ -40,8 +40,8 @@ function onSiteDependenciesLoaded() {
4040

4141
functionPlot({
4242
target: '#description-sin-exp-x',
43-
yAxis: { domain: [-4, 4] },
44-
xAxis: { domain: [-2, 6] },
43+
y: { domain: [-4, 4] },
44+
x: { domain: [-2, 6] },
4545
tip: {
4646
renderer: function () {}
4747
},
@@ -88,12 +88,12 @@ function onSiteDependenciesLoaded() {
8888
* - `title`: the title of the graph
8989
* - `width`: width of the graph
9090
* - `height`: height of the graph
91-
* - `xAxis`:
91+
* - `x`:
9292
* - `type`: the type of scale for this axis, possible values `linear|log`
9393
* (default value: `'linear'`)
9494
* - `label`: x axis label
9595
* - `domain`: x axis possible values (see examples below)
96-
* - `yAxis`: same options as `xAxis`
96+
* - `y`: same options as `x`
9797
* - `disableZoom`: true to disable translation/scaling on the graph
9898
*/
9999
functionPlot({
@@ -102,11 +102,11 @@ function onSiteDependenciesLoaded() {
102102
width: 580,
103103
height: 400,
104104
disableZoom: true,
105-
xAxis: {
105+
x: {
106106
label: 'x - axis',
107107
domain: [-6, 6]
108108
},
109-
yAxis: {
109+
y: {
110110
label: 'y - axis'
111111
},
112112
data: [
@@ -123,10 +123,10 @@ function onSiteDependenciesLoaded() {
123123
*/
124124
functionPlot({
125125
target: '#grid',
126-
xAxis: {
126+
x: {
127127
label: 'real'
128128
},
129-
yAxis: {
129+
y: {
130130
label: 'imaginary'
131131
},
132132
grid: true,
@@ -151,8 +151,8 @@ function onSiteDependenciesLoaded() {
151151
*/
152152
functionPlot({
153153
target: '#domain',
154-
yAxis: { domain: [-1, 1] },
155-
xAxis: { domain: [8, 24] },
154+
y: { domain: [-1, 1] },
155+
x: { domain: [8, 24] },
156156
data: [
157157
{
158158
fn: 'sin(x)'
@@ -204,7 +204,7 @@ function onSiteDependenciesLoaded() {
204204
*/
205205
functionPlot({
206206
target: '#annotations',
207-
yAxis: { domain: [-1, 9] },
207+
y: { domain: [-1, 9] },
208208
data: [
209209
{
210210
fn: 'x^2'
@@ -238,7 +238,7 @@ function onSiteDependenciesLoaded() {
238238
*/
239239
functionPlot({
240240
target: '#closed',
241-
xAxis: { domain: [-2, 12] },
241+
x: { domain: [-2, 12] },
242242
data: [
243243
{
244244
fn: '3 + sin(x)',
@@ -252,16 +252,16 @@ function onSiteDependenciesLoaded() {
252252
* ### Logarithmic scales
253253
*
254254
* The type of each axis can be configured to be logarithmic by specifying the
255-
* type of axis to `log` inside the `xAxis` option, note how this
255+
* type of axis to `log` inside the `x` option, note how this
256256
* change affects the way the functions are sampled
257257
*/
258258
functionPlot({
259259
target: '#logarithmic',
260-
xAxis: {
260+
x: {
261261
type: 'log',
262262
domain: [0.01, 1]
263263
},
264-
yAxis: {
264+
y: {
265265
domain: [-100, 100]
266266
},
267267
grid: true,
@@ -391,8 +391,8 @@ function onSiteDependenciesLoaded() {
391391
*/
392392
functionPlot({
393393
target: '#secant',
394-
yAxis: { domain: [-1, 9] },
395-
xAxis: { domain: [-3, 3] },
394+
y: { domain: [-1, 9] },
395+
x: { domain: [-3, 3] },
396396
data: [
397397
{
398398
fn: 'x^2',
@@ -448,7 +448,7 @@ function onSiteDependenciesLoaded() {
448448
*/
449449
functionPlot({
450450
target: '#derivative',
451-
yAxis: { domain: [-1, 9] },
451+
y: { domain: [-1, 9] },
452452
data: [
453453
{
454454
fn: 'x^2',
@@ -469,7 +469,7 @@ function onSiteDependenciesLoaded() {
469469
*/
470470
functionPlot({
471471
target: '#derivative-update',
472-
yAxis: { domain: [-1, 9] },
472+
y: { domain: [-1, 9] },
473473
data: [
474474
{
475475
fn: 'x^2',
@@ -520,13 +520,13 @@ function onSiteDependenciesLoaded() {
520520
a = functionPlot({
521521
target: '#linked-a',
522522
height: 250,
523-
xAxis: { domain: [-10, 10] },
523+
x: { domain: [-10, 10] },
524524
data: [{ fn: 'x * x' }]
525525
})
526526
b = functionPlot({
527527
target: '#linked-b',
528528
height: 250,
529-
xAxis: { domain: [-10, 10] },
529+
x: { domain: [-10, 10] },
530530
data: [{ fn: '2 * x' }]
531531
})
532532
a.addLink(b)
@@ -546,19 +546,19 @@ function onSiteDependenciesLoaded() {
546546
a = functionPlot({
547547
target: '#linked-a-multiple',
548548
height: 250,
549-
xAxis: { domain: [-10, 10] },
549+
x: { domain: [-10, 10] },
550550
data: [{ fn: 'x * x' }]
551551
})
552552
b = functionPlot({
553553
target: '#linked-b-multiple',
554554
height: 250,
555-
xAxis: { domain: [-10, 10] },
555+
x: { domain: [-10, 10] },
556556
data: [{ fn: '2 * x' }]
557557
})
558558
c = functionPlot({
559559
target: '#linked-c-multiple',
560560
height: 250,
561-
xAxis: { domain: [-10, 10] },
561+
x: { domain: [-10, 10] },
562562
data: [{ fn: '2' }]
563563
})
564564
a.addLink(b, c)
@@ -675,8 +675,8 @@ function onSiteDependenciesLoaded() {
675675
*/
676676
functionPlot({
677677
target: '#circle-explicit',
678-
yAxis: { domain: [-1.897959183, 1.897959183] },
679-
xAxis: { domain: [-3, 3] },
678+
y: { domain: [-1.897959183, 1.897959183] },
679+
x: { domain: [-3, 3] },
680680
data: [{ fn: 'sqrt(1 - x * x)' }, { fn: '-sqrt(1 - x * x)' }]
681681
})
682682

@@ -708,8 +708,8 @@ function onSiteDependenciesLoaded() {
708708
*/
709709
functionPlot({
710710
target: '#parametric-circle',
711-
yAxis: { domain: [-1.897959183, 1.897959183] },
712-
xAxis: { domain: [-3, 3] },
711+
y: { domain: [-1.897959183, 1.897959183] },
712+
x: { domain: [-3, 3] },
713713
data: [
714714
{
715715
x: 'cos(t)',
@@ -734,8 +734,8 @@ function onSiteDependenciesLoaded() {
734734
*/
735735
functionPlot({
736736
target: '#butterfly-curve',
737-
yAxis: { domain: [-4.428571429, 4.428571429] },
738-
xAxis: { domain: [-7, 7] },
737+
y: { domain: [-4.428571429, 4.428571429] },
738+
x: { domain: [-7, 7] },
739739
data: [
740740
{
741741
x: 'sin(t) * (exp(cos(t)) - 2 cos(4t) - sin(t/12)^5)',
@@ -774,8 +774,8 @@ function onSiteDependenciesLoaded() {
774774
*/
775775
functionPlot({
776776
target: '#polar-circle',
777-
yAxis: { domain: [-1.897959183, 1.897959183] },
778-
xAxis: { domain: [-3, 3] },
777+
y: { domain: [-1.897959183, 1.897959183] },
778+
x: { domain: [-3, 3] },
779779
data: [
780780
{
781781
r: 'r0 * cos(theta - gamma) + sqrt(a^2 - r0^2 * (sin(theta - gamma))^2)',
@@ -801,8 +801,8 @@ function onSiteDependenciesLoaded() {
801801
*/
802802
functionPlot({
803803
target: '#polar-complex',
804-
yAxis: { domain: [-1.897959183, 1.897959183] },
805-
xAxis: { domain: [-3, 3] },
804+
y: { domain: [-1.897959183, 1.897959183] },
805+
x: { domain: [-3, 3] },
806806
data: [
807807
{
808808
r: '2 * sin(4 theta)',
@@ -838,8 +838,8 @@ function onSiteDependenciesLoaded() {
838838
*/
839839
functionPlot({
840840
target: '#circle-implicit',
841-
yAxis: { domain: [-1.897959183, 1.897959183] },
842-
xAxis: { domain: [-3, 3] },
841+
y: { domain: [-1.897959183, 1.897959183] },
842+
x: { domain: [-3, 3] },
843843
data: [
844844
{
845845
fn: 'x * x + y * y - 1',
@@ -863,7 +863,7 @@ function onSiteDependenciesLoaded() {
863863
functionPlot({
864864
target: '#implicit-complex',
865865
yAxis: { domain: [-3.795918366, 3.795918366] },
866-
xAxis: { domain: [-6, 6] },
866+
x: { domain: [-6, 6] },
867867
disableZoom: true,
868868
data: [
869869
{
@@ -928,7 +928,7 @@ function onSiteDependenciesLoaded() {
928928
*/
929929
functionPlot({
930930
target: '#vector',
931-
xAxis: { domain: [-3, 8] },
931+
x: { domain: [-3, 8] },
932932
grid: true,
933933
data: [
934934
{

0 commit comments

Comments
 (0)