@@ -40,6 +40,7 @@ var sampleSource = [
4040 // igConfig.SampleCopyPath + '/charts/data-chart/chart-performance/package.json',
4141 // igConfig.SampleCopyPath + '/charts/financial-chart/high-frequency/package.json',
4242 // igConfig.SampleCopyPath + '/charts/financial-chart/high-volume/package.json',
43+ // igConfig.SampleCopyPath + '/charts/data-chart/data-annotation-multiple-with-stocks/package.json',
4344
4445 // including samples for specific components:
4546 // igConfig.SampleCopyPath + '/charts/category-chart/**/package.json',
@@ -636,6 +637,7 @@ function updateCodeViewer(cb) {
636637
637638 var content = "{\r\n \"sampleFiles\":\r\n" ;
638639
640+ var dataFiles = [ ] ;
639641 var contentItems = [ ] ;
640642 var tsxItem = new CodeViewer ( sample . SampleFilePath , sample . SampleFileSourceCode , "tsx" , "tsx" , true ) ;
641643
@@ -650,10 +652,26 @@ function updateCodeViewer(cb) {
650652 else if ( file . indexOf ( ".ts" ) > 0 && file . indexOf ( "index.tsx" ) === - 1 ) {
651653 var tsContent = fs . readFileSync ( file , "utf8" ) ;
652654 var tsItem = new CodeViewer ( file , tsContent , "ts" , "DATA" , true ) ;
653- contentItems . push ( tsItem ) ;
655+ dataFiles . push ( tsItem ) ;
654656 }
655657 }
656658
659+ if ( dataFiles . length === 1 ) {
660+ contentItems . push ( dataFiles [ 0 ] ) ;
661+ } else if ( dataFiles . length > 1 ) {
662+ // combining multiple data files into one data source
663+ var dataPath = dataFiles [ 0 ] . path ;
664+ var dataFolder = dataPath . substring ( 0 , dataPath . lastIndexOf ( "/" ) ) ;
665+ var dataContent = "// NOTE this file contains multiple data sources:\r\n" ;
666+ for ( let i = 0 ; i < dataFiles . length ; i ++ ) {
667+ const data = dataFiles [ i ] ;
668+ dataContent += "\r\n\r\n" + "// Data Source #" + ( i + 1 ) + "\r\n" ;
669+ dataContent += data . content + "\r\n" ;
670+ }
671+ var dataItem = new CodeViewer ( dataFolder + "/DataSources.ts" , dataContent , "ts" , "DATA" , true ) ;
672+ contentItems . push ( dataItem ) ;
673+ }
674+
657675 content += JSON . stringify ( contentItems , null , ' ' ) ;
658676 content += "\r\n}" ;
659677
0 commit comments