Movatterモバイル変換


[0]ホーム

URL:


  • Overview
  • View Specification
  • Data / Datasets
  • Transform
  • Mark
  • Encoding
  • Projection
  • View Composition
  • Parameter
  • Config

  • Property Types
  • Tooltip
  • Invalid Data
  • Text

    Edit this page
    // Single View Specification{  "data": ... ,  "mark": "text",  "encoding": ... ,  ...}

    text mark represents each data point with a text instead of a point.

    Documentation Overview

    Text Mark Properties

    // Single View Specification{  ...  "mark": {    "type": "text",    ...  },  "encoding": ... ,  ...}

    A text mark definition can contain anystandard mark properties and the following special properties:

    PropertyTypeDescription
    angleNumber |ExprRef

    The rotation angle of the text, in degrees.

    alignString |ExprRef

    The horizontal alignment of the text or ranged marks (area, bar, image, rect, rule). One of"left","right","center".

    Note: Expression reference isnot supported for range marks.

    baselineString |ExprRef

    For text marks, the vertical text baseline. One of"alphabetic" (default),"top","middle","bottom","line-top","line-bottom", or an expression reference that provides one of the valid values. The"line-top" and"line-bottom" values operate similarly to"top" and"bottom", but are calculated relative to thelineHeight rather thanfontSize alone.

    For range marks, the vertical alignment of the marks. One of"top","middle","bottom".

    Note: Expression reference isnot supported for range marks.

    dirString |ExprRef

    The direction of the text. One of"ltr" (left-to-right) or"rtl" (right-to-left). This property determines on which side is truncated in response to the limit parameter.

    Default value:"ltr"

    dxNumber |ExprRef

    The horizontal offset, in pixels, between the text label and its anchor point. The offset is applied after rotation by theangle property.

    dyNumber |ExprRef

    The vertical offset, in pixels, between the text label and its anchor point. The offset is applied after rotation by theangle property.

    ellipsisString |ExprRef

    The ellipsis string for text truncated in response to the limit parameter.

    Default value:"…"

    fontString |ExprRef

    The typeface to set the text in (e.g.,"Helvetica Neue").

    fontSizeNumber |ExprRef

    The font size, in pixels.

    Default value:11

    fontStyleString |ExprRef

    The font style (e.g.,"italic").

    fontWeightString | Number |ExprRef

    The font weight. This can be either a string (e.g"bold","normal") or a number (100,200,300, …,900 where"normal" =400 and"bold" =700).

    limitNumber |ExprRef

    The maximum length of the text mark in pixels. The text value will be automatically truncated if the rendered size exceeds the limit.

    Default value:0 – indicating no limit

    lineHeightNumber |ExprRef

    The line height in pixels (the spacing between subsequent lines of text) for multi-line text marks.

    radiusNumber |ExprRef

    For arc mark, the primary (outer) radius in pixels.

    For text marks, polar coordinate radial offset, in pixels, of the text from the origin determined by thex andy properties.

    Default value:min(plot_width, plot_height)/2

    textText |ExprRef

    Placeholder text if thetext channel is not specified

    thetaNumber |ExprRef
    • For arc marks, the arc length in radians if theta2 is not specified, otherwise the start arc angle. (A value of 0 indicates up or “north”, increasing values proceed clockwise.)

    • For text marks, polar coordinate angle in radians.

    Examples

    Text Table Heatmap

    Labels

    You can also usetext marks as labels for other marks and set offset (dx ordy),align, andbaseline properties of the mark definition.

    Scatterplot with Text

    Mapping a field totext channel of text mark sets the mark’s text value. For example, we can make a colored scatterplot with text marks showing the initial character of its origin, instead ofpoint marks.

    Geo Text

    By mapping geographic coordinate data tolongitude andlatitude channels of a correspondingprojection, we can show text at accurate locations. The example below shows the name of every US state capital at the location of the capital.

    Text Config

    // Top-level View Specification{  ...  "config": {    "text": ...,    ...  }}

    Thetext property of the top-levelconfig object sets the default properties for all text marks. Ifmark property encoding channels are specified for marks, these config values will be overridden.


[8]ページ先頭

©2009-2025 Movatter.jp