@@ -55,7 +55,7 @@ export interface IRenderOptions {
5555 /**
5656 * Path to electron, so that electron can be installed separately to a different location and shared
5757 * between the various packages that need it.
58- *
58+ *
5959 * Electron is used to render charts and capture them to images.
6060 */
6161 electronPath ?: string ;
@@ -353,8 +353,8 @@ export abstract class AbstractPlotAPI implements IPlotAPI {
353353 electronPath : renderOptions && renderOptions . electronPath ,
354354 inflateOptions : {
355355 inMemoryFiles : [
356- {
357- file : "chart-def.json" ,
356+ {
357+ file : "chart-def.json" ,
358358 content : JSON . stringify ( chartDef , null , 4 ) ,
359359 } ,
360360 ] ,
@@ -379,13 +379,13 @@ export abstract class AbstractPlotAPI implements IPlotAPI {
379379 const exportTemplateOptions : IExportOptions = {
380380 overwrite,
381381 inMemoryFiles : [
382- {
383- file : "chart-def.json" ,
382+ {
383+ file : "chart-def.json" ,
384384 content : JSON . stringify ( chartDef , null , 4 ) ,
385385 } ,
386386 ] ,
387387 } ;
388-
388+
389389 await exportTemplate ( templatePath , { chartDef } , outputFolderPath , exportTemplateOptions ) ;
390390
391391 if ( exportOptions && exportOptions . openBrowser ) {
@@ -396,7 +396,7 @@ export abstract class AbstractPlotAPI implements IPlotAPI {
396396 /**
397397 * Serialize the plot definition so that it can be converted to JSON.
398398 * The JSON definition of the chart can be used to instantiate the chart in a browser.
399- *
399+ *
400400 * TODO: This function doesn't really belong in the abstract class, it would be better to live the concrete PlotAPI class.
401401 */
402402 serialize ( ) : IChartDef {
@@ -430,6 +430,15 @@ export abstract class AbstractPlotAPI implements IPlotAPI {
430430 */
431431export class PlotAPI extends AbstractPlotAPI {
432432
433+ /**
434+ * Deserialize an instance of PlotAPI from a previously serialize chart def.
435+ *
436+ * @param chartDef The chart definition to deserialize from.
437+ */
438+ static deserialize ( chartDef : IChartDef ) : IPlotAPI {
439+ return new PlotAPI ( chartDef . data , chartDef . plotConfig , true , chartDef . axisMap ) ;
440+ }
441+
433442 constructor ( data : ISerializedDataFrame , plotConfig : IPlotConfig , showLegendDefault : boolean , globalAxisMap ?: IAxisMap ) {
434443 assert . isObject ( data , "Expected 'data' parameter to PlotAPI constructor to be a serialized dataframe." ) ;
435444
@@ -497,7 +506,7 @@ export class PlotAPI extends AbstractPlotAPI {
497506 }
498507
499508 //
500- //TODO: I'm sure if the expansion should happen here in the serialization?
509+ // TODO: I'm sure if the expansion should happen here in the serialization?
501510 // I feel there should be another function that does this expansion and that made it should happen
502511 // separately when the chart is rendered.
503512 //
@@ -592,16 +601,6 @@ export class PlotAPI extends AbstractPlotAPI {
592601
593602 super ( data , expandedPlotConfig , expandedGlobalAxisMap ) ;
594603 }
595-
596- /**
597- * Deserialize an instance of PlotAPI from a previously serialize chart def.
598- *
599- * @param chartDef The chart definition to deserialize from.
600- */
601- static deserialize ( chartDef : IChartDef ) : IPlotAPI {
602- return new PlotAPI ( chartDef . data , chartDef . plotConfig , true , chartDef . axisMap ) ;
603- }
604-
605604}
606605
607606/**
@@ -787,7 +786,7 @@ class YAxisConfigAPI extends AxisConfigAPI<IYAxisConfigAPI, ISingleYAxisMap> imp
787786 * @param value The minimum value to render.
788787 */
789788 min ( value : number ) : IYAxisConfigAPI {
790- //todo:
789+ // todo:
791790 return this ;
792791 }
793792
@@ -796,7 +795,7 @@ class YAxisConfigAPI extends AxisConfigAPI<IYAxisConfigAPI, ISingleYAxisMap> imp
796795 * @param value The maximum value to render.
797796 */
798797 max ( value : number ) : IYAxisConfigAPI {
799- //todo:
798+ // todo:
800799 return this ;
801800 }
802801
0 commit comments