@@ -128,15 +128,21 @@ const graphDiv = "#test";
128
128
} as PlotData ;
129
129
const data = [ trace1 , trace2 , trace3 ] ;
130
130
const layout = {
131
- title : "Gapminder" ,
131
+ title : {
132
+ text : "Gapminder" ,
133
+ } ,
132
134
xaxis : {
133
- title : "Life Expectancy" ,
135
+ title : {
136
+ text : "Life Expectancy" ,
137
+ } ,
134
138
domain : [ 0 , 0.85 ] ,
135
139
showgrid : false ,
136
140
zeroline : false ,
137
141
} ,
138
142
yaxis : {
139
- title : "GDP per Cap" ,
143
+ title : {
144
+ text : "GDP per Cap" ,
145
+ } ,
140
146
showline : false ,
141
147
domain : [ 0 , 0.85 ] ,
142
148
showgrid : false ,
@@ -165,7 +171,7 @@ const graphDiv = "#test";
165
171
type : "scatter" ,
166
172
} as PlotData ,
167
173
] ;
168
- const layout2 = { title : "Revenue" } ;
174
+ const layout2 = { title : { text : "Revenue" } } ;
169
175
Plotly . newPlot ( graphDiv , data2 , layout2 ) ;
170
176
} ) ( ) ;
171
177
( ( ) => {
@@ -313,7 +319,7 @@ const graphDiv = "#test";
313
319
yanchor : "top" ,
314
320
} ;
315
321
316
- const layout : Partial < Layout > = { showlegend : true , title : "January 2013 Sales Report" , template, modebar, legend } ;
322
+ const layout : Partial < Layout > = { showlegend : true , title : { text : "January 2013 Sales Report" } , template, modebar, legend } ;
317
323
const config : Partial < Config > = {
318
324
modeBarButtons : [
319
325
[
@@ -414,7 +420,9 @@ const graphDiv = "#test";
414
420
} ,
415
421
] ;
416
422
const layout : Partial < Layout > = {
417
- title : "Grouped Box Plot" ,
423
+ title : {
424
+ text : "Grouped Box Plot" ,
425
+ } ,
418
426
boxmode : "overlay" ,
419
427
} ;
420
428
@@ -425,7 +433,9 @@ const graphDiv = "#test";
425
433
const data : Array < Partial < PlotData > > = [
426
434
{
427
435
colorbar : {
428
- title : "Test" ,
436
+ title : {
437
+ text : "Test" ,
438
+ } ,
429
439
} ,
430
440
locationmode : "ISO-3" ,
431
441
locations : [ "USA" , "NLD" ] ,
@@ -436,7 +446,9 @@ const graphDiv = "#test";
436
446
] ;
437
447
const layout : Partial < Layout > = {
438
448
showlegend : true ,
439
- title : "World Map" ,
449
+ title : {
450
+ text : "World Map" ,
451
+ } ,
440
452
geo : {
441
453
projection : { type : "Mercator" } ,
442
454
showcoastlines : true ,
@@ -577,7 +589,9 @@ const graphDiv = "#test";
577
589
// update only values within nested objects
578
590
( ( ) => {
579
591
const update = {
580
- title : "some new title" , // updates the title
592
+ title : { // updates the title
593
+ text : "some new title" ,
594
+ } ,
581
595
"xaxis.range" : [ 0 , 5 ] , // updates the xaxis range
582
596
"yaxis.range[1]" : 15 , // updates the end of the yaxis range
583
597
} as Layout ;
@@ -589,7 +603,9 @@ const graphDiv = "#test";
589
603
marker : { color : "red" } ,
590
604
} ;
591
605
const layout_update = {
592
- title : "some new title" , // updates the title
606
+ title : { // updates the title
607
+ text : "some new title" ,
608
+ } ,
593
609
} ;
594
610
Plotly . update ( graphDiv , data_update , layout_update ) ;
595
611
} ) ( ) ;
@@ -620,7 +636,9 @@ const graphDiv = "#test";
620
636
marker : { color : "red" } ,
621
637
} ;
622
638
const layout_update = {
623
- title : "some new title" , // updates the title
639
+ title : { // updates the title
640
+ text : "some new title" ,
641
+ } ,
624
642
} ;
625
643
Plotly . update ( graphDiv , data_update , layout_update ) ;
626
644
} ) ( ) ;
0 commit comments