UNPKG

plotly.js

Version:

The open source javascript graphing library that powers plotly

121 lines (113 loc) • 4.06 kB
'use strict'; var colorAttrs = require('../../components/color/attributes'); var domainAttrs = require('../domain').attributes; var axesAttrs = require('../cartesian/layout_attributes'); var overrideAll = require('../../plot_api/edit_types').overrideAll; var extendFlat = require('../../lib/extend').extendFlat; var ternaryAxesAttrs = { title: { text: axesAttrs.title.text, font: axesAttrs.title.font // TODO does standoff here make sense? }, color: axesAttrs.color, // ticks tickmode: axesAttrs.minor.tickmode, nticks: extendFlat({}, axesAttrs.nticks, {dflt: 6, min: 1}), tick0: axesAttrs.tick0, dtick: axesAttrs.dtick, tickvals: axesAttrs.tickvals, ticktext: axesAttrs.ticktext, ticks: axesAttrs.ticks, ticklen: axesAttrs.ticklen, tickwidth: axesAttrs.tickwidth, tickcolor: axesAttrs.tickcolor, ticklabelstep: axesAttrs.ticklabelstep, showticklabels: axesAttrs.showticklabels, labelalias: axesAttrs.labelalias, showtickprefix: axesAttrs.showtickprefix, tickprefix: axesAttrs.tickprefix, showticksuffix: axesAttrs.showticksuffix, ticksuffix: axesAttrs.ticksuffix, showexponent: axesAttrs.showexponent, exponentformat: axesAttrs.exponentformat, minexponent: axesAttrs.minexponent, separatethousands: axesAttrs.separatethousands, tickfont: axesAttrs.tickfont, tickangle: axesAttrs.tickangle, tickformat: axesAttrs.tickformat, tickformatstops: axesAttrs.tickformatstops, hoverformat: axesAttrs.hoverformat, // lines and grids showline: extendFlat({}, axesAttrs.showline, {dflt: true}), linecolor: axesAttrs.linecolor, linewidth: axesAttrs.linewidth, showgrid: extendFlat({}, axesAttrs.showgrid, {dflt: true}), gridcolor: axesAttrs.gridcolor, gridwidth: axesAttrs.gridwidth, griddash: axesAttrs.griddash, layer: axesAttrs.layer, // range min: { valType: 'number', dflt: 0, min: 0, description: [ 'The minimum value visible on this axis.', 'The maximum is determined by the sum minus the minimum', 'values of the other two axes. The full view corresponds to', 'all the minima set to zero.' ].join(' ') }, // spikelines showspikes: extendFlat({}, axesAttrs.showspikes, { description: [ 'Determines whether or not spikes (aka droplines) are drawn for this axis.', 'Ternary spikes are accompanied by axis value labels formatted according to `hoverformat`.', ].join(' ') }), spikecolor: axesAttrs.spikecolor, spikethickness: axesAttrs.spikethickness, spikedash: axesAttrs.spikedash, spikemode: axesAttrs.spikemode, spikesnap: axesAttrs.spikesnap, }; var attrs = module.exports = overrideAll({ domain: domainAttrs({name: 'ternary'}), bgcolor: { valType: 'color', dflt: colorAttrs.background, description: 'Set the background color of the subplot' }, sum: { valType: 'number', dflt: 1, min: 0, description: [ 'The number each triplet should sum to,', 'and the maximum range of each axis' ].join(' ') }, aaxis: ternaryAxesAttrs, baxis: ternaryAxesAttrs, caxis: ternaryAxesAttrs }, 'plot', 'from-root'); // set uirevisions outside of `overrideAll` so we can get `editType: none` attrs.uirevision = { valType: 'any', editType: 'none', description: [ 'Controls persistence of user-driven changes in axis `min` and `title`,', 'if not overridden in the individual axes.', 'Defaults to `layout.uirevision`.' ].join(' ') }; attrs.aaxis.uirevision = attrs.baxis.uirevision = attrs.caxis.uirevision = { valType: 'any', editType: 'none', description: [ 'Controls persistence of user-driven changes in axis `min`,', 'and `title` if in `editable: true` configuration.', 'Defaults to `ternary<N>.uirevision`.' ].join(' ') };