@@ -35,6 +35,7 @@ var handleTraceDefaults = function(traceIn, traceOut, coords, layout) {
3535 handleDefaults ( traceIn , traceOut , coords [ i ] + 'calendar' , layout . calendar ) ;
3636 }
3737} ;
38+
3839// each calendar needs its own default canonical tick. I would love to use
3940// 2000-01-01 (or even 0000-01-01) for them all but they don't necessarily
4041// all support either of those dates. Instead I'll use the most significant
@@ -164,10 +165,77 @@ function getCal(calendar) {
164165 return calendarObj ;
165166}
166167
168+ function makeAttrs ( description ) {
169+ return Lib . extendFlat ( { } , attributes , { description : description } ) ;
170+ }
171+
172+ function makeTraceAttrsDescription ( coord ) {
173+ return 'Sets the calendar system to use with `' + coord + '` date data.' ;
174+ }
175+
176+ var xAttrs = {
177+ xcalendar : makeAttrs ( makeTraceAttrsDescription ( 'x' ) )
178+ } ;
179+
180+ var xyAttrs = Lib . extendFlat ( { } , xAttrs , {
181+ ycalendar : makeAttrs ( makeTraceAttrsDescription ( 'y' ) )
182+ } ) ;
183+
184+ var xyzAttrs = Lib . extendFlat ( { } , xyAttrs , {
185+ zcalendar : makeAttrs ( makeTraceAttrsDescription ( 'z' ) )
186+ } ) ;
187+
188+ var axisAttrs = makeAttrs ( [
189+ 'Sets the calendar system to use for `range` and `tick0`' ,
190+ 'if this is a date axis. This does not set the calendar for' ,
191+ 'interpreting data on this axis, that\'s specified in the trace' ,
192+ 'or via the global `layout.calendar`'
193+ ] . join ( ' ' ) ) ;
194+
167195module . exports = {
168196 moduleType : 'component' ,
169197 name : 'calendars' ,
170198
199+ schema : {
200+ traces : {
201+ scatter : xyAttrs ,
202+ bar : xyAttrs ,
203+ heatmap : xyAttrs ,
204+ contour : xyAttrs ,
205+ histogram : xyAttrs ,
206+ histogram2d : xyAttrs ,
207+ histogram2dcontour : xyAttrs ,
208+ scatter3d : xyzAttrs ,
209+ surface : xyzAttrs ,
210+ mesh3d : xyzAttrs ,
211+ scattergl : xyAttrs ,
212+ ohlc : xAttrs ,
213+ candlestick : xAttrs
214+ } ,
215+ layout : {
216+ calendar : makeAttrs ( [
217+ 'Sets the default calendar system to use for interpreting and' ,
218+ 'displaying dates throughout the plot.'
219+ ] . join ( ' ' ) ) ,
220+ 'xaxis.calendar' : axisAttrs ,
221+ 'yaxis.calendar' : axisAttrs ,
222+ 'scene.xaxis.calendar' : axisAttrs ,
223+ 'scene.yaxis.calendar' : axisAttrs ,
224+ 'scene.zaxis.calendar' : axisAttrs
225+ } ,
226+ transforms : {
227+ filter : {
228+ calendar : makeAttrs ( [
229+ 'Sets the calendar system to use for `value`, if it is a date.' ,
230+ 'Note that this is not necessarily the same calendar as is used' ,
231+ 'for the target data; that is set by its own calendar attribute,' ,
232+ 'ie `trace.x` uses `trace.xcalendar` etc.'
233+ ] . join ( ' ' ) )
234+ }
235+ }
236+ } ,
237+
238+ layoutAttributes : attributes ,
171239
172240 handleDefaults : handleDefaults ,
173241 handleTraceDefaults : handleTraceDefaults ,
0 commit comments