graph » scale-k » media-rules

media-rules

[ root » graph » scale-k » media-rules]

Media rules allow for the creation of responsive charts by changing how the chart and its various objects appear at different breakpoints (or chart dimensions). You can create media rules based on the width and/or height of the chart. Try interacting with the following chart. Refer to the Media Rules Tutorial for more information.



AttributeTypeDescription
anchorStringAllows you to set an object's anchor position
Accepted Values: ['tl', 'tr', 'bl', 'br', 'c', 't', 'r', 'b', 'l']
Default Value: 'tl'
aspectStringSets the aspect of the `series` data points in the chart.
Accepted Values: ['star', 'circle']
Default Value: 'star'
Chart types: Radar
blendedBooleanTo 'blend' or 'stick' secondary scales to the primary one. Use with the 'placement' attribute (set the value to 'default') and 'offset-start' and 'offset-end' attributes.
Default Value: false
Introduced in: v2.3.0
borderRadius
border-radius
NumberSets the object's border radius for rounded corners. Larger values create rounder corners, while smaller values create sharper corners. A single value will affect all 4 corners; multiple values will have separate effects on each corner, with the first value affecting the top-left corner, the second value affecting the top-right corner, and so on, in a clockwise direction. A negative value will cut a corner off without rounding.
Default Value: 0
borderRadiusBottomLeft
border-radius-bottom-left
NumberSets the object's bottom-left border radius for rounded corners. Larger values create rounder corners, while smaller values create sharper corners. A negative value will cut a corner off without rounding.
Default Value: 0
borderRadiusBottomRight
border-radius-bottom-right
NumberSets the object's bottom-right border radius for rounded corners. Larger values create rounder corners, while smaller values create sharper corners. A negative value will cut a corner off without rounding.
Default Value: 0
borderRadiusTopLeft
border-radius-top-left
NumberSets the object's top-left border radius for rounded corners. Larger values create rounder corners, while smaller values create sharper corners. A negative value will cut a corner off without rounding.
Default Value: 0
borderRadiusTopRight
border-radius-top-right
NumberSets the object's top-right border radius for rounded corners. Larger values create rounder corners, while smaller values create sharper corners. A negative value will cut a corner off without rounding.
Default Value: 0
classStringSets a class value on the object.
Default Value: null
dataN
data-n
AnyPrefix attribute or array using "data-" to define a custom token.
decimalsNumberSets the number of decimal places displayed for each value.
Default Value: -1
Chart types: Gauge
decimalsSeparator
decimals-separator
StringSets the separator to be used in place of the default decimal point. Any string or character can be used to replace the decimal.
Default Value: '.'
Chart types: Gauge
defaultValue
default-value
StringSets the default value token values to display until the value is available.
Default Value: null
Chart types: Gauge
exponentBooleanSets whether the scale values will be displayed in scientific notation. Particularly useful when dealing with large numbers.
Default Value: false
Chart types: Gauge
exponentDecimals
exponent-decimals
NumberSets the number of decimals that will be displayed when using scientific notation. Use with the 'exponent' attribute.
Default Value: 2
Chart types: Gauge
flatBooleanSet to true disables the chart interactivity.
Default Value: false
formatStringTo format the appearance of the scale values. Use with the %scale-value (%v) token.
Default Value: null
Chart types: Gauge
guideObjectUsed to style the lines and backgrounds behind the plotted data.
Default Value: null
idStringSets the id of the object.
Default Value: ''
itemsOverlap
items-overlap
BooleanTo force all of the scale items to display. It is generally used with the 'max-items' attribute.
Default Value: false
labelsArray.<Number,String>Sets the labels.
Chart types: Gauge
logBase
log-base
NumberLogarithmic Scales only: To set the base value, which defaults to Math.E (Euler's number, the base of natural logarithms).
Default Value: 10
masterStringSets a master scale. The current scale will always be in sync with it's master scale.
Default Value: ''
max-value-factorBooleanRatio from (max-min) interval which will be added to the max value.
Default Value: true
maxDecimals
max-decimals
NumberSets the max number of decimals that will be used to format the values.
Default Value: -1
Chart types: Gauge
maxHeight
max-height
NumberSets the maximum chart height in pixels.
Introduced in: v2.4.1
maxItems
max-items
NumberSets the maximum number of items displayed.
Chart types: Gauge
maxTicks
max-ticks
NumberSets the maximum number of ticks to display on the scale.
Chart types: Gauge
maxWidth
max-width
NumberSets the maximum chart width in pixels.
Introduced in: v2.4.1
min-value-factorBooleanRatio from (max-min) interval which will be subtracted to the min value.
Default Value: true
minHeight
min-height
NumberSets the minimum chart height in pixels.
Introduced in: v2.4.1
minWidth
min-width
NumberSets the minimum chart width in pixels.
Introduced in: v2.4.1
negationStringThis attribute will determine how negative values are handled. When using "format":"$%v" setting "negation":"currency" will move the - symbol to the outside of the $ sign. When using "negation" within the "plot": { } object you will see changes in things such as tooltips or anywhere else series data is used to populate values. You need to set "negation" in things such as "scale-y": { } separately.
Accepted Values: ['standard', 'currency']
Default Value: 'standard'
progressionStringTo change the scale type from linear (default) to logarithmic.
Accepted Values: ['lin', 'linear', 'log']
Default Value: 'lin'
rangedBooleanSets the scale as "ranged", basically the node is placed in the middle of the interval between two scale values.
Default Value: false
rectShortcut
rect-shortcut
BooleanUsed to force the library to create rectangles using a faster drawing API (instead of painting them like a closed polygon). However, using this would disable effects like rounded borders. It is a performance setting for edge cases.
Default Value: false
shortBooleanAutomatically shortens large units (e.g. 1000000 -> 1M)
Default Value: false
Chart types: Gauge
shortUnit
short-unit
StringSpecifies which unit of measure to use when `short` is set to true.
Accepted Values: ['k', 'K', 'm', 'M', 'b', 'B']
Default Value: ''
Chart types: Gauge
showLabels
show-labels
Array.<String>Sets a filter to show only specific items on a scale. It does NOT force the display of the specified items if those are not already generated by the scale.
Default Value: null
Chart types: Gauge
stepNumberThe 'step': attribute sets the value of each step along an axis. When using numeric values along the axis, a numeric value for 'step': will incrementally increase the value of each tick along the axis by the specified step value. When the transform attribute is set to 'type':'date', a number of different step values can then be used to modify the step increments.
Accepted Values: [`${number}`, `${number|''}second`, `${number|''}minute`, `${number|''}hour`, `${number|''}day`, `${number|''}week`, `${number|''}month`, `${number|''}year`]
Default Value: 1
Chart types: Gauge
stepMultiplier
step-multiplier
NumberApplies a multiplier to the interval used to show ticks/items on scale. The multiplier is not applied only if the number of items currently active is greater than the multiplier value. Otherwise, all items are being displayed.
Introduced in: v2.9.1
thousandsSeparator
thousands-separator
StringSets the character used to separate thousands.
Default Value: ''
tickObjectUsed to style the scale tick marks.
Default Value: null
transformObjectTransforms data to specified format. For example, if data is coded as date and time, `type: 'date'` is specifed in this object, and `scaleX.transform: '%D, %d %M %h:%i %A'` is set, then '1311261385209' will display 'Wed, 19 of May 05:00 PM'.
Default Value: null
Chart types: Gauge
usedBooleanForces the display of the scale, even if its not used on any plot.
Default Value: false
valuesArray.<Number,String>, Number, StringSets the scale values.
Default Value: []
visibleBooleanSets the visibility of the object. Allows you to turn off the object without removing lines of JSON.
Default Value: true
zIndex
z-index
NumberSets the z position of the object. Objects with higher z indexes will appear "above" those with lower z index values.
Default Value: 1