@@ -46,6 +46,7 @@ var sampleSources = [
46
46
// igConfig.SamplesCopyPath + '/charts/data-chart/chart-performance/package.json',
47
47
// igConfig.SamplesCopyPath + '/charts/financial-chart/high-frequency/package.json',
48
48
// igConfig.SamplesCopyPath + '/charts/financial-chart/high-volume/package.json',
49
+ // igConfig.SamplesCopyPath + '/charts/data-chart/data-annotation-multiple-with-stocks/package.json',
49
50
50
51
// including all samples for all components:
51
52
igConfig . SamplesCopyPath + '/**/package.json' ,
@@ -728,6 +729,7 @@ function updateCodeViewer(cb) {
728
729
729
730
var content = "{\r\n \"sampleFiles\":\r\n" ;
730
731
var contentItems = [ ] ;
732
+ var dataFiles = [ ] ;
731
733
732
734
var tsItem = new CodeViewer ( sample . SampleFilePath , sample . SampleFileSourceCode , "ts" , "ts" , true ) ;
733
735
@@ -739,19 +741,40 @@ function updateCodeViewer(cb) {
739
741
var cssItem = new CodeViewer ( file , cssContent , "css" , "css" , true ) ;
740
742
contentItems . push ( cssItem ) ;
741
743
}
744
+ else if ( file . indexOf ( ".html" ) > 0 ) {
745
+ var tsContent = fs . readFileSync ( file , "utf8" ) ;
746
+ var tsItem = new CodeViewer ( file , tsContent , "html" , "html" , true ) ;
747
+ contentItems . push ( tsItem ) ;
748
+ }
742
749
else if ( file . indexOf ( ".ts" ) > 0 && file . indexOf ( sample . SampleFileName ) == - 1 ) {
743
750
744
- var isIndex = file . indexOf ( "index.ts" ) > 0 ;
745
751
var tsContent = fs . readFileSync ( file , "utf8" ) ;
746
752
var tsItem = new CodeViewer ( file , tsContent , "ts" , "ts" , true ) ;
747
- tsItem . fileHeader = isIndex ? "ts" : "DATA" ;
748
- contentItems . push ( tsItem ) ;
753
+
754
+ if ( file . indexOf ( "index.ts" ) > 0 ) {
755
+ tsItem . fileHeader = "ts" ;
756
+ contentItems . push ( tsItem ) ;
757
+ } else {
758
+ tsItem . fileHeader = "DATA" ;
759
+ dataFiles . push ( tsItem ) ;
760
+ }
749
761
}
750
- else if ( file . indexOf ( ".html" ) > 0 ) {
751
- var tsContent = fs . readFileSync ( file , "utf8" ) ;
752
- var tsItem = new CodeViewer ( file , tsContent , "html" , "html" , true ) ;
753
- contentItems . push ( tsItem ) ;
762
+ }
763
+
764
+ if ( dataFiles . length === 1 ) {
765
+ contentItems . push ( dataFiles [ 0 ] ) ;
766
+ } else if ( dataFiles . length > 1 ) {
767
+ // combining multiple data files into one data source
768
+ var dataPath = dataFiles [ 0 ] . path ;
769
+ var dataFolder = dataPath . substring ( 0 , dataPath . lastIndexOf ( "/" ) ) ;
770
+ var dataContent = "// NOTE this file contains multiple data sources:" ;
771
+ for ( let i = 0 ; i < dataFiles . length ; i ++ ) {
772
+ const data = dataFiles [ i ] ;
773
+ dataContent += "\r\n\r\n" + "// Data Source #" + ( i + 1 ) + "\r\n" ;
774
+ dataContent += data . content + "\r\n" ;
754
775
}
776
+ var dataItem = new CodeViewer ( dataFolder + "/DataSources.ts" , dataContent , "ts" , "DATA" , true ) ;
777
+ contentItems . push ( dataItem ) ;
755
778
}
756
779
757
780
content += JSON . stringify ( contentItems , null , ' ' ) ;
0 commit comments