@@ -146,7 +146,7 @@ export class DataSource extends DataSourceApi<MyQuery, MyDataSourceOptions> {
146146 const dataFrameArray : DataFrame [ ] = [ ] ;
147147 for ( let res of results ) {
148148 const dataPathArray : string [ ] = DataSource . getDataPathArray ( res . query . dataPath ) ;
149- const { groupBy, aliasBy } = res . query ;
149+ const { timePath , timeFormat , groupBy, aliasBy } = res . query ;
150150 const split = groupBy . split ( ',' ) ;
151151 const groupByList : string [ ] = [ ] ;
152152 for ( const element of split ) {
@@ -160,8 +160,8 @@ export class DataSource extends DataSourceApi<MyQuery, MyDataSourceOptions> {
160160
161161 const dataFrameMap = new Map < string , MutableDataFrame > ( ) ;
162162 for ( const doc of docs ) {
163- if ( doc . Time ) {
164- doc . Time = dateTime ( doc . Time ) ;
163+ if ( timePath in doc ) {
164+ doc [ timePath ] = dateTime ( doc [ timePath ] , timeFormat ) ;
165165 }
166166 const identifiers : string [ ] = [ ] ;
167167 for ( const groupByElement of groupByList ) {
@@ -178,7 +178,7 @@ export class DataSource extends DataSourceApi<MyQuery, MyDataSourceOptions> {
178178 }
179179 for ( const fieldName in doc ) {
180180 let t : FieldType = FieldType . string ;
181- if ( fieldName === 'Time' || isRFC3339_ISO6801 ( String ( doc [ fieldName ] ) ) ) {
181+ if ( fieldName === timePath || isRFC3339_ISO6801 ( String ( doc [ fieldName ] ) ) ) {
182182 t = FieldType . time ;
183183 } else if ( _ . isNumber ( doc [ fieldName ] ) ) {
184184 t = FieldType . number ;
@@ -227,17 +227,18 @@ export class DataSource extends DataSourceApi<MyQuery, MyDataSourceOptions> {
227227 return Promise . all ( [ this . createQuery ( query , options . range ) ] ) . then ( ( results : any ) => {
228228 const r : AnnotationEvent [ ] = [ ] ;
229229 for ( const res of results ) {
230+ const { timePath, endTimePath, timeFormat } = res . query ;
230231 const dataPathArray : string [ ] = DataSource . getDataPathArray ( res . query . dataPath ) ;
231232 for ( const dataPath of dataPathArray ) {
232233 const docs : any [ ] = DataSource . getDocs ( res . results . data , dataPath ) ;
233234 for ( const doc of docs ) {
234235 const annotation : AnnotationEvent = { } ;
235- if ( doc . Time ) {
236- annotation . time = dateTime ( doc . Time ) . valueOf ( ) ;
236+ if ( timePath in doc ) {
237+ annotation . time = dateTime ( doc [ timePath ] , timeFormat ) . valueOf ( ) ;
237238 }
238- if ( doc . TimeEnd ) {
239+ if ( endTimePath in doc ) {
239240 annotation . isRegion = true ;
240- annotation . timeEnd = dateTime ( doc . TimeEnd ) . valueOf ( ) ;
241+ annotation . timeEnd = dateTime ( doc [ endTimePath ] , timeFormat ) . valueOf ( ) ;
241242 }
242243 let title = query . annotationTitle ;
243244 let text = query . annotationText ;
0 commit comments