• Getting Started

  • Data

  • Chart Types

  • Chart Elements

  • Integrations

  • API

  • Tools

  • FAQ

  • Change Log

  • Crosshairs

    Overview

    Crosshairs are interactive labels that appear when users hover over data points on your chart. They are an alternative to standard tooltips, which appear by default across ZingChart chart types. Highly customizable, crosshairs can display any combination of tokens and text. They can be shared across multiple charts in a graphset and be set to display under different exact and trigger modes. Refer to the Crosshairs JSON page for a full list of attribute options.

    Note: You can use the multiGuide object to pin crosshair guides to a chart on a click. Learn more about our multiGuide JSON configuration here.

    X-Axis Crosshairs

    Users generally start with crosshairs on the x-axis. Create a crosshair-x object. Without further modification, plot and scale labels will appear, connected by vertical lines, when you move your mouse over the chart.

    Note: When working with crosshairs, it is best to disable the tooltips, which appear across our charting library by default. In the plot object, create a tooltip object. Add a visible attribute, and set the value to false.

    {
      type: 'line',
      crosshairX: {
    
      },
      plot: {
        tooltip: {
            visible: false
        }
      },
      series: [{
        values: [20, 40, 25, 50, 15, 45, 33, 34, 49, 53, 19, 35, 24],
        text: 'Blueberries'
      }, {
        values: [11, 30, 21, 18, 59, 50, 28, 33, 23, 15, 18, 26, 34],
        text: 'Cherries'
      }, {
        values: [30, 21, 18, 21, 33, 41, 29, 15, 11, 12, 26, 23, 26],
        text: 'Kiwis'
      }, {
        values: [34, 16, 26, 15, 19, 21, 20, 24, 35, 41, 42, 38, 39],
        text: 'Kumquats'
      }]
    }
    

    With x-axis crosshairs, you can customize the text and appearance of the plot and scale labels. You can also style the crosshair lines, add crosshair markers, share crosshairs across two or more charts in a graphset array, and utilize different exact and trigger modes. You can browse our Crosshairs JSON page for a full list of attribute options.

    Plot Labels

    To customize the plot labels, create a plot-label object in crosshair-x. You'll place applicable attributes in this object. Refer to the Crosshair Plot Labels JSON page for more information.

    Note: You can also turn off the visibility of the plot labels by adding a visible attribute to the plot-label object and setting the value to false.

    crosshairX: {
      plotLabel: {
        //Place applicable attributes here.
      },
      ...
    }
    

    Text and Tokens

    To change the default plot label text, add a text attribute to the plot-label object. You can provide any combination of alphanumeric characters and/or ZingChart tokens. Refer to the Tokens Tutorial for a full list of available tokens.

    Here is how the text appears in a single series chart, or a chart with a single dataset.

    https://app.zingsoft.com/demos/embed/MD08TIFQ
    https://app.zingsoft.com/demos/embed/MD08TIFQ
    {
      type: 'line',
      crosshairX: {
        plotLabel: {
          text: 'The %t Series has a value of %v.'
        }
      },
      plot: {
        tooltip: {
          visible: false
        }
      },
      series: [{
        values: [20, 40, 25, 50, 15, 45, 33, 34, 49, 53, 19, 35, 24],
        text: 'Blueberry'
      }]
    }
    

    Here is how the text appears in a chart with multiple series. Notice how the text repeats for each series. You can break apart this text and/or provide custom text for each individual series, as explained in the following Multiple Plot Labels section.

    https://app.zingsoft.com/demos/embed/04X9XW3R
    https://app.zingsoft.com/demos/embed/04X9XW3R
    {
      type: 'line',
      crosshairX: {
        plotLabel: {
          text: 'The %t Series has a value of %v.'
        }
      },
      plot: {
        tooltip: {
          visible: false
        }
      },
      series: [{
        values: [20, 40, 25, 50, 15, 45, 33, 34, 49, 53, 19, 35, 24],
        text: 'Blueberry'
      }, {
        values: [11, 30, 21, 18, 59, 50, 28, 33, 23, 15, 18, 26, 34],
        text: 'Cherry'
      }, {
        values: [30, 21, 18, 21, 33, 41, 29, 15, 11, 12, 26, 23, 26],
        text: 'Kiwi'
      }, {
        values: [34, 16, 26, 15, 19, 21, 20, 24, 35, 41, 42, 38, 39],
        text: 'Kumquat'
      }]
    }
    

    Multiple Plot Labels

    When you have multiple series (or datasets), you may want to break apart the plot labels so that a label appears for each series. To do this, add a multiple attribute to the plot-label object. Set the value to true. Note that each series displays the same text. However, you can specify unique text for each series, as shown in the next chart.

    https://app.zingsoft.com/demos/embed/38O4OP4V
    https://app.zingsoft.com/demos/embed/38O4OP4V
    {
      type: 'line',
      crosshairX: {
        plotLabel: {
          text: 'The %t Series has a value of %v.',
          multiple: true
        }
      },
      plot: {
        tooltip: {
          visible: false
        }
      },
      series: [{
        values: [20, 40, 25, 50, 15, 45, 33, 34, 49, 53, 19, 35, 24],
        text: 'Blueberry'
      }, {
        values: [11, 30, 21, 18, 59, 50, 28, 33, 23, 15, 18, 26, 34],
        text: 'Cherry'
      }, {
        values: [30, 21, 18, 21, 33, 41, 29, 15, 11, 12, 26, 23, 26],
        text: 'Kiwi'
      }, {
        values: [34, 16, 26, 15, 19, 21, 20, 24, 35, 41, 42, 38, 39],
        text: 'Kumquat'
      }]
    }
    

    For series-specific text, first make sure that the multiple attribute is set to true in the plot-label object. Next, go to the series array. In each series object, create a guide-label object. Add a text attribute, and provide your desired text and/or tokens.

    https://app.zingsoft.com/demos/embed/SQD0YHYO
    https://app.zingsoft.com/demos/embed/SQD0YHYO
    {
      type: 'line',
      crosshairX: {
        plotLabel: {
          multiple: true
        }
      },
      plot: {
        tooltip: {
          visible: false
        }
      },
      series: [{
        values: [20, 40, 25, 50, 15, 45, 33, 34, 49, 53, 19, 35, 24],
        text: 'Blueberries',
        guideLabel: {
          text: '%t are like pearls.'
        }
      }, {
        values: [11, 30, 21, 18, 59, 50, 28, 33, 23, 15, 18, 26, 34],
        text: 'Cherries',
        guideLabel: {
          text: '%t often come in twos and threes.'
        }
      }, {
        values: [30, 21, 18, 21, 33, 41, 29, 15, 11, 12, 26, 23, 26],
        text: 'Kiwis',
        guideLabel: {
          text: '%t have lots of seeds that look like freckles.'
        }
      }, {
        values: [34, 16, 26, 15, 19, 21, 20, 24, 35, 41, 42, 38, 39],
        text: 'Kumquats',
        guideLabel: {
          text: '%t are like tiny, oval oranges.'
        }
      }]
    }
    

    Styling

    When styling your plot labels, you can provide attributes such as font-color, font-family, font-size, background-color, border-width, border-color, line-style, border-radius, padding, callout, and more. See the Crosshair Plot Labels JSON page for a full list of available attributes.

    To apply styling globally (or to all series), add the attributes to the plot-label object.

    https://app.zingsoft.com/demos/embed/N0G702GP
    https://app.zingsoft.com/demos/embed/N0G702GP
    {
      type: 'line',
      crosshairX: {
        plotLabel: {
          text: 'The %t Series has a value of %v.',
          fontColor: '#6600ff',
          fontFamily: 'Georgia',
          fontSize: 12,
          backgroundColor: 'pink yellow',
          borderWidth: '1px',
          borderColor: '#6600ff',
          lineStyle: 'dashdot',
          borderRadius: '10px',
          padding: '10%',
          callout: true
        }
      },
      plot: {
        tooltip: {
          visible: false
        }
      },
      series: [{
        values: [20, 40, 25, 50, 15, 45, 33, 34, 49, 53, 19, 35, 24],
        text: 'Blueberry'
      }, {
        values: [11, 30, 21, 18, 59, 50, 28, 33, 23, 15, 18, 26, 34],
        text: 'Cherry'
      }, {
        values: [30, 21, 18, 21, 33, 41, 29, 15, 11, 12, 26, 23, 26],
        text: 'Kiwi'
      }, {
        values: [34, 16, 26, 15, 19, 21, 20, 24, 35, 41, 42, 38, 39],
        text: 'Kumquat'
      }]
    }
    

    To apply styling locally (or to individual series), add the attributes to the applicable guide-label object(s) in the series array. Note that you can make both global and local changes by providing attributes for the former in the plot-label object and attributes for the latter in the applicable guide-label object(s).

    https://app.zingsoft.com/demos/embed/7NILHPYH
    https://app.zingsoft.com/demos/embed/7NILHPYH
    {
      type: 'line',
      crosshairX: {
        plotLabel: {
          multiple: true,
          fontFamily: 'Georgia',
          borderWidth: '2px',
          borderRadius: '5px',
          padding: '5%'
        }
      },
      plot: {
        tooltip: {
          visible: false
        }
      },
      series: [{
        values: [20, 40, 25, 50, 15, 45, 33, 34, 49, 53, 19, 35, 24],
        text: 'Blueberries',
        guideLabel: {
          text: '%t are like pearls.',
          fontColor: '#009933',
          borderColor: '#9966ff',
          lineStyle: 'dotted'
        }
      }, {
        values: [11, 30, 21, 18, 59, 50, 28, 33, 23, 15, 18, 26, 34],
        text: 'Cherries',
        guideLabel: {
          text: '%t often come in twos and threes.',
          fontColor: '#000099',
          borderColor: '#ff00ff',
          lineStyle: 'dashed'
        }
      }, {
        values: [30, 21, 18, 21, 33, 41, 29, 15, 11, 12, 26, 23, 26],
        text: 'Kiwis',
        guideLabel: {
          text: '%t have lots of seeds that look like freckles.',
          fontColor: '#6666ff',
          borderColor: '#00ffff',
          lineStyle: 'solid'
        }
      }, {
        values: [34, 16, 26, 15, 19, 21, 20, 24, 35, 41, 42, 38, 39],
        text: 'Kumquats',
        guideLabel: {
          text: '%t are like tiny, oval oranges.',
          fontColor: '#ff3300',
          borderColor: '#99cc00',
          lineStyle: 'dashdot'
        }
      }]
    }
    

    Scale Labels

    To customize the scale labels, create a scale-label object in crosshair-x. You'll place applicable attributes in this object. Refer to the Crosshair Scale Labels JSON page for more information.

    Note: You can also turn off the visibility of the scale labels by adding a visible attribute to the scale-label object and setting the value to false.

    crosshairX: {
      scaleLabel: {
        //Place applicable attributes here.
      },
      ...
    }
    

    Text and Tokens

    How you modify the appearance of the scale label text will most likely depend on whether you have a category or time-series scale on the x-axis.

    Here is a chart with a category scale. You can use the text attribute to add additional verbiage to the %l token (which displays the scale labels provided in the scale-x object). Refer to the Configuring Your Scales Tutorial for more information on category scales.

    https://app.zingsoft.com/demos/embed/256D95G1
    https://app.zingsoft.com/demos/embed/256D95G1
    {
      type: 'line',
      crosshairX: {
        scaleLabel: {
          text: '%l 2016'
        }
      },
      scaleX: {
        labels: [ 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' ],
        item: {
          maxChars: 3
        }
      },
      plot: {
        tooltip: {
          visible: false
        }
      },
      series: [{
        values: [20, 40, 25, 50, 15, 45, 33, 34, 49, 53, 19, 35],
        text: 'Blueberries'
      }, {
        values: [11, 30, 21, 18, 59, 50, 28, 33, 23, 15, 18, 26],
        text: 'Cherries'
      }, {
        values: [30, 21, 18, 21, 33, 41, 29, 15, 11, 12, 26, 23],
        text: 'Kiwis'
      }, {
        values: [34, 16, 26, 15, 19, 21, 20, 24, 35, 41, 42, 38],
        text: 'Kumquats'
      }]
    }
    

    On a time-series scale, you can use a text attribute in the scale-label object to add additional verbiage to your scale labels. You can also change the time-series formatting by adding a transform object. Add a type attribute and set the value to date. Add an all attribute and specify how you want the time-series values formatted. Refer to the Configuring Your Scales Tutorial for more information on time-series scales.

    https://app.zingsoft.com/demos/embed/5TG7HMCY
    https://app.zingsoft.com/demos/embed/5TG7HMCY
    {
      type: 'line',
      crosshairX: {
        scaleLabel: {
          text: '%v<br>at 12 p.m.',
          transform: {
            type: 'date',
            all: '%D,<br>%M %d, %Y'
          }
        }
      },
      scaleX: {
        minValue: 1451649600000,
        step: 'day',
        transform: {
          type: 'date',
          all: '%m/%d'
        },
        maxItems: 12
      },
      plot: {
        tooltip: {
          visible: false
        }
      },
      series: [
        {
          values: [
          //Omitted for brevity.
          ],
          text: 'Blueberries'
        },
        {
          values: [
          //Omitted for brevity.
          ],
          text: 'Cherries'
        },
        {
          values: [
          //Omitted for brevity.
          ],
          text: 'Kiwis'
        },
        {
          values: [
          //Omitted for brevity.
          ],
          text: 'Kumquats'
        }
      ]
    }
    

    Styling

    Customize the styling of your scale labels with attributes such as font-color, font-family, font-size, background-color, border-width, border-color, line-style, border-radius, padding, and more. See the Crosshair Scale Labels JSON page for a full attribute list.

    https://app.zingsoft.com/demos/embed/JIXF9M02
    https://app.zingsoft.com/demos/embed/JIXF9M02
    {
      type: 'line',
      crosshairX: {
        scaleLabel: {
          fontColor: '#6600ff',
          fontFamily: 'Georgia',
          fontSize: 12,
          backgroundColor: 'pink yellow',
          borderWidth: '1px',
          borderColor: '#6600ff',
          lineStyle: 'dashdot',
          borderRadius: '10px',
          padding: '10%'
        }
      },
      scaleX: {
        labels: [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ]
      },
      plot: {
        tooltip: {
          visible: false
        }
      },
      series: [{
        values: [20, 40, 25, 50, 15, 45, 33, 34, 49, 53, 19, 35],
        text: 'Blueberries'
      }, {
        values: [11, 30, 21, 18, 59, 50, 28, 33, 23, 15, 18, 26],
        text: 'Cherries'
      }, {
        values: [30, 21, 18, 21, 33, 41, 29, 15, 11, 12, 26, 23],
        text: 'Kiwis'
      }, {
        values: [34, 16, 26, 15, 19, 21, 20, 24, 35, 41, 42, 38],
        text: 'Kumquats'
      }]
    }
    

    Crosshair Lines

    You can style the appearance of the crosshair lines, which appear gray by default. Add attributes such as line-color, line-width, and line-style (dotted, dashed, dashdot, solid) to the crosshair-x object.

    https://app.zingsoft.com/demos/embed/YUDVI073
    https://app.zingsoft.com/demos/embed/YUDVI073
    {
      type: 'line',
      crosshairX: {
        lineColor: '#6600ff',
        lineWidth: '2px',
        lineStyle: 'dashdot'
      },
      plot: {
        tooltip: {
          visible: false
        }
      },
      series: [{
        values: [20, 40, 25, 50, 15, 45, 33, 34, 49, 53, 19, 35, 24],
        text: 'Blueberries'
      }, {
        values: [11, 30, 21, 18, 59, 50, 28, 33, 23, 15, 18, 26, 34],
        text: 'Cherries'
      }, {
        values: [30, 21, 18, 21, 33, 41, 29, 15, 11, 12, 26, 23, 26],
        text: 'Kiwis'
      }, {
        values: [34, 16, 26, 15, 19, 21, 20, 24, 35, 41, 42, 38, 39],
        text: 'Kumquats'
      }]
    }
    

    You can also make full width crosshair lines. This can be accomplished through lineWidth: '100%'

    https://app.zingsoft.com/demos/embed/J7TPL042
    https://app.zingsoft.com/demos/embed/J7TPL042
    crosshairX: {
      lineWidth: '100%',
      lineColor: '#ccc',
      alpha: 0.5,
      plotLabel: {
        visible: false
      }
    }
    

    Crosshair Markers

    You have the option of adding crosshair markers, which will activate when users hover over the applicable node index. In the crosshair-x object, create a marker object. Make sure to specify the marker size with the size attribute. You can also add attributes such as type, background-color, border-width, and border-color. Refer to the Crosshair Markers JSON page for more information.

    https://app.zingsoft.com/demos/embed/QHBOAU52
    https://app.zingsoft.com/demos/embed/QHBOAU52
    {
      type: 'line',
      crosshairX: {
        marker: {
          type: 'star5',
          size: 5, //Make sure to specify size.
          backgroundColor: 'yellow',
          borderWidth: '1px',
          borderColor: 'gray'
        }
      },
      plot: {
        tooltip: {
          visible: false
        }
      },
      series: [{
        values: [20, 40, 25, 50, 15, 45, 33, 34, 49, 53, 19, 35, 24],
        text: 'Blueberries'
      }, {
        values: [11, 30, 21, 18, 59, 50, 28, 33, 23, 15, 18, 26, 34],
        text: 'Cherries'
      }, {
        values: [30, 21, 18, 21, 33, 41, 29, 15, 11, 12, 26, 23, 26],
        text: 'Kiwis'
      }, {
        values: [34, 16, 26, 15, 19, 21, 20, 24, 35, 41, 42, 38, 39],
        text: 'Kumquats'
      }]
    }
    

    Shared Mode

    You can share crosshairs between two or more charts in a graphset array by adding a shared attribute to the applicable crosshair-x objects and setting the value to true. To learn how to create a graphset array (used to make dashboards, trellis/small multiple charts, and more), see our Adding Additional Charts Tutorial. For more on shared interactions between different charts in a graphset array, see our Shared Interactions Tutorial, which explains how to utilize shared zooming, scrollbars, preview charts, and legends.

    Note: Depending on what you are trying to create, using mixed charts and blended scales is another way to display shared crosshairs between two or more charts.

    https://app.zingsoft.com/demos/embed/7L9D58RG
    https://app.zingsoft.com/demos/embed/7L9D58RG
    {
      graphset: [{
        type: 'line',
        x: '0%',
        y: '0%',
        height: '50%',
        width: '100%',
        crosshairX: {
          shared: true
        },
        plot: {
          tooltip: {
            visible: false
          }
        },
        plotarea: {
          adjustLayout: true
        },
        scaleX: {
          item: {
            fontSize: 10
          }
        },
        scaleY: {
          item: {
            fontSize: 10
          }
        },
        series: [{
          values: [20, 40, 25, 50, 15, 45, 33, 34, 49, 53, 19, 35, 24]
        }, {
          values: [11, 30, 21, 18, 59, 50, 28, 33, 23, 15, 18, 26, 34]
        }]
      }, {
        type: 'line',
        x: '0%',
        y: '50%',
        height: '50%',
        width: '100%',
        crosshairX: {
          shared: true
        },
        plot: {
          tooltip: {
            visible: false
          }
        },
        plotarea: {
          adjustLayout: true
        },
        scaleX: {
          item: {
            fontSize: 10
          }
        },
        scaleY: {
          item: {
            fontSize: 10
          }
        },
        series: [{
          values: [30, 21, 18, 21, 33, 41, 29, 15, 11, 12, 26, 23, 26]
        }, {
          values: [34, 16, 26, 15, 19, 21, 20, 24, 35, 41, 42, 38, 39]
        }]
      }]
    }
    

    Here is a stock and volume chart, along with a stacked bar chart that breaks down the fund by sector type. The crosshairs between the stock and volume chart are shared.

    https://app.zingsoft.com/demos/embed/SLXR5CCV
    https://app.zingsoft.com/demos/embed/SLXR5CCV
    {
      graphset: [{
        title: {
          text: 'Stock Fund Performance Chart'
        },
        type: 'stock',
        height: '60%',
        width: '75%',
        x: '0%',
        y: '0%',
        crosshairX: {
          plotLabel: {
            text: 'Open: $%open<br>High: $%high<br>Low: $%low<br>Close: $%close',
            decimals: 2
          },
          scaleLabel: {
            visible: false
          },
          shared: true
        },
        scaleX: {
          visible: false
        },
        scaleY: {
          values: '29:33:2',
          format: '$%v',
          label: {
            text: 'Prices'
          },
          item: {
            fontSize: 10
          },
          guide: {
            lineStyle: 'solid'
          }
        },
        plot: {
          aspect: 'whisker',
          tooltip: {
            visible: false
          },
          trendUp: {
    
          },
          trendDown: {
            alpha: 0.5
          }
        },
        plotarea: {
          marginBottom: 'dynamic'
        },
        series: [{
          values: [
            //Omitted for brevity.
          ]
        }]
      }, {
        type: 'area',
        height: '40%',
        width: '75%',
        x: '0%',
        y: '60%',
        crosshairX: {
          plotLabel: {
            text: 'Volume: %vM',
            decimals: 2
          },
          scaleLabel: {
            text: '%v'
          },
          shared: true
        },
        scaleX: {
          minValue: 1422910800000,
          step: 'day',
          transform: {
            type: 'date',
            all: '%D,<br>%m/%d'
          },
          maxItems: 6,
          item: {
            fontSize: 10
          }
        },
        scaleY: {
          values: '0:3:3',
          format: '%vM',
          label: {
            text: 'Volume'
          },
          item: {
            fontSize: 10
          },
          guide: {
            lineStyle: 'solid'
          }
        },
        plot: {
          tooltip: {
            visible: false
          },
          lineWidth: '1px',
          marker: {
            visible: false
          }
        },
        plotarea: {
          marginTop: 'dynamic'
        },
        series: [{
          values: [
            //Omitted for brevity.
          ]
        }]
      }, {
        type: 'bar',
        height: '100%',
        width: '25%',
        x: '75%',
        y: '0%',
        scaleX: {
          placement: 'opposite',
          label: {
            text: 'Sector Breakdown'
          },
          labels: [ '' ],
          tick: {
            visible: false
          }
        },
        scaleY: {
          format: '%v%',
          values: '0:100:25',
          guide: {
            lineStyle: 'solid'
          },
          item: {
            fontSize: 10
          },
        },
        plot: {
          stacked: true,
          stackType: '100%',
          tooltip: {
            text: '%t'
          }
        },
        series: [{
          values: [59],
          text: 'Consumer Goods'
        }, {
          values: [55],
          text: 'Information Technology'
        }, {
          values: [30],
          text: 'Financials'
        }, {
          values: [28],
          text: 'Healthcare'
        }, {
          values: [15],
          text: 'Industrials'
        }]
      }]
    }
    

    Here are three candlestick charts displayed as a small multiple or trellis chart. The crosshairs between all three charts are shared.

    https://app.zingsoft.com/demos/embed/U2JT3IE8
    https://app.zingsoft.com/demos/embed/U2JT3IE8
    {
      graphset: [{
        title: {
          text: 'Index Fund Comparison Chart'
        },
        type: 'stock',
        x: '0%',
        y: '0%',
        height: '40%',
        width: '100%',
        crosshairX: {
          plotLabel: {
            text: 'Open: $%open<br>High: $%high<br>Low: $%low<br>Close: $%close',
            borderColor: '#6600cc'
          },
          scaleLabel: {
            visible: false
          },
          shared: true
        },
        scaleX: {
          minValue: 1420232400000,
          step: 'day',
          transform: {
            type: 'date',
            all: '%m/%d/%y'
          },
          maxItems: 6,
          item: {
            fontSize: 10
          }
        },
        scaleY: {
          values: '30:34:4',
          format: '$%v',
          guide: {
            lineStyle: 'solid'
          },
          item: {
            fontSize: 10
          }
        },
        plot: {
          aspect: 'candlestick',
            tooltip: {
            visible: false
          },
          trendUp: {
            backgroundColor: '#6600cc',
            lineColor: '#6600cc',
            borderColor: '#6600cc'
          },
          trendDown: {
            backgroundColor: 'none',
            lineColor: '#6600cc',
            borderColor: '#6600cc'
          }
        },
        plotarea: {
          marginBottom: 'dynamic',
          marginTop: '40%'
        },
        series: [{
          values: [
            //Omitted for brevity.
          ]
        }]
      }, {
        type: 'stock',
        x: '0%',
        y: '40%',
        height: '30%',
        width: '100%',
        crosshairX: {
          plotLabel: {
            text: 'Open: $%open<br>High: $%high<br>Low: $%low<br>Close: $%close',
            borderColor: '#6699ff'
          },
          scaleLabel: {
            visible: false
          },
          shared: true
        },
        scaleX: {
          minValue: 1420232400000,
          step: 'day',
          transform: {
            type: 'date',
            all: '%m/%d/%y'
          },
          maxItems: 6,
          item: {
            fontSize: 10
          }
        },
        scaleY: {
          values: '30:34:4',
          format: '$%v',
          guide: {
            lineStyle: 'solid'
          },
          item: {
            fontSize: 10
          }
        },
        plot: {
          aspect: 'candlestick',
          tooltip: {
            visible: false
          },
          trendUp: {
            backgroundColor: '#6699ff',
            lineColor: '#6699ff',
            borderColor: '#6699ff'
          },
          trendDown: {
            backgroundColor: 'none',
            lineColor: '#6699ff',
            borderColor: '#6699ff'
          }
        },
        plotarea: {
          marginBottom: 'dynamic',
          marginTop: '30%'
        },
        series: [{
          values: [
            //Omitted for brevity.
          ]
        }]
      }, {
        type: 'stock',
        x: '0%',
        y: '70%',
        height: '30%',
        width: '100%',
        crosshairX: {
          plotLabel: {
            text: 'Open: $%open<br>High: $%high<br>Low: $%low<br>Close: $%close',
            borderColor: '#339966'
          },
          scaleLabel: {
    
          },
          shared: true
        },
        scaleX: {
          minValue: 1420232400000,
          step: 'day',
          transform: {
            type: 'date',
            all: '%m/%d/%y'
          },
          maxItems: 6,
          item: {
            fontSize: 10
          }
        },
        scaleY: {
          values: '30:34:4',
          format: '$%v',
          guide: {
            lineStyle: 'solid'
          },
          item: {
            fontSize: 10
          }
        },
        plot: {
          aspect: 'candlestick',
          tooltip: {
            visible: false
          },
          trendUp: {
            backgroundColor: '#339966',
            lineColor: '#339966',
            borderColor: '#339966'
          },
          trendDown: {
            backgroundColor: 'none',
            lineColor: '#339966',
            borderColor: '#339966'
          }
        },
        plotarea: {
          marginBottom: 'dynamic',
          marginTop: '20%'
        },
        series: [{
          values: [
            //Omitted for brevity.
          ]
        }]
      }]
    }
    

    Exact Mode

    By adding an exact attribute and setting the value to true, the crosshairs won't activate until the user's mouse hovers near a node index that contains a data point (or node value). In the following chart, if you enter the plotarea at node index 6 or 7, no crosshairs appear. Start moving toward node index 4 or 9 (where there are data points), and the crosshairs will display. Users can "reset" this mode by moving their mouse out of the plotarea, and then re-entering the chart.

    https://app.zingsoft.com/demos/embed/53U7I0BZ
    https://app.zingsoft.com/demos/embed/53U7I0BZ
    {
      type: 'area',
      title: {
        text: 'Exact Mode'
      },
      crosshairX: {
        exact: true, //false (default) or true
        plotLabel: {
          text: 'X: %kv<br>Y: %vv'
        }
      },
      plot: {
        tooltip: {
          visible: false
        },
        rules: [{
          rule: '%v < 20',
          lineColor: 'red',
          backgroundColor: 'red'
        }, {
          rule: '%v >= 20 && %v <= 40',
          lineColor: 'orange',
          backgroundColor: 'orange'
        }, {
          rule: '%v >= 40 && %v <= 50',
          lineColor: 'orange',
          backgroundColor: 'yellow'
        }, {
          rule: '%v >= 50 && %v <= 60',
          lineColor: 'blue',
          backgroundColor: 'green'
        }, {
          rule: '%v >= 60 && %v <= 80',
          lineColor: 'blue',
          backgroundColor: 'blue'
        }, {
          rule: '%v > 80',
          lineColor: 'purple',
          backgroundColor: 'purple'
        }],
        marker: {
          rules: [{
            rule: '%v < 20',
            backgroundColor: 'red'
          }, {
            rule: '%v >= 20 && %v <= 50',
            backgroundColor: 'orange'
          }, {
            rule: '%v >= 50 && %v <= 80',
            backgroundColor: 'blue'
          }, {
            rule: '%v > 80',
            backgroundColor: 'purple'
          }]
        }
      },
      series: [{
        values: [
          //Omitted for brevity.
        ]
      }]
    }
    

    The exact mode is most useful (and visibly obvious) on charts that have breaks or gaps in their data, as often occurs with array of arrays (above example) and time-series (below example) data. Since it is activated by the user hovering near the node index that contains a data point (rather than the data point itself), it may be more useful on charts such as column and bar.

    https://app.zingsoft.com/demos/embed/WXWMPLXP
    https://app.zingsoft.com/demos/embed/WXWMPLXP
    {
      type: 'bar',
      title: {
        text: 'Exact Mode'
      },
      crosshairX: {
        exact: true, //false (default) or true
        plotLabel: {
          text: '%vv bars at %kv',
          transform: {
            type: 'date',
            all: '%g:%i %a'
          }
        }
      },
      scaleX: {
        minValue: 1451606436000,
        maxValue: 1451692836000,
        step: 'hour',
        transform: {
          type: 'date',
          all: '%g %a'
        },
        maxItems: 9,
        item: {
          fontSize: 10
        }
      },
      utc: true,
      plot: {
        tooltip: {
          visible: false
        },
        barWidth: '40%',
        backgroundColor: 'pink orange',
        borderWidth: '1px',
        borderColor: 'gray'
      },
      series: [{
        values: [
          //Omitted for brevity.
        ]
      }]
    }
    

    Trigger Mode

    By adding a trigger attribute and setting the value to hover, the crosshairs won't activate until the user's mouse hovers over a data point (or node value). In the following chart, if you hover over the empty areas of the chart, no crosshairs appear. Hover over an actual data point, and the crosshairs will display. Users can "reset" this mode by moving their mouse out of the plotarea, and then re-entering the chart.

    https://app.zingsoft.com/demos/embed/MVW7T53M
    https://app.zingsoft.com/demos/embed/MVW7T53M
    {
      type: 'area',
      title: {
        text: 'Trigger Mode'
      },
      crosshairX: {
        trigger: 'hover', //'move' (default) or 'hover'
        plotLabel: {
          text: 'X: %kv<br>Y: %vv'
        }
      },
      plot: {
        tooltip: {
          visible: false
        },
        rules: [{
          rule: '%v < 20',
          lineColor: 'red',
          backgroundColor: 'red'
        }, {
          rule: '%v >= 20 && %v <= 40',
          lineColor: 'orange',
          backgroundColor: 'orange'
        }, {
          rule: '%v >= 40 && %v <= 50',
          lineColor: 'orange',
          backgroundColor: 'yellow'
        }, {
          rule: '%v >= 50 && %v <= 60',
          lineColor: 'blue',
          backgroundColor: 'green'
        }, {
          rule: '%v >= 60 && %v <= 80',
          lineColor: 'blue',
          backgroundColor: 'blue'
        }, {
          rule: '%v > 80',
          lineColor: 'purple',
          backgroundColor: 'purple'
        }],
        marker: {
          rules: [{
            rule: '%v < 20',
            backgroundColor: 'red'
          }, {
            rule: '%v >= 20 && %v <= 50',
            backgroundColor: 'orange'
          }, {
            rule: '%v >= 50 && %v <= 80',
            backgroundColor: 'blue'
          }, {
            rule: '%v > 80',
            backgroundColor: 'purple'
          }]
        }
      },
      series: [{
        values: [
          //Omitted for brevity.
        ]
      }]
    }
    

    The trigger mode is most useful (and visibly obvious) on charts that have breaks or gaps in their data, as often occurs with array of arrays (above example) or time-series (below example) data. Since it is activated by the user hovering over the actual data point (and not the node index that contains it), it may be more useful on charts such as scatter plots.

    https://app.zingsoft.com/demos/embed/0X9FI2O7
    https://app.zingsoft.com/demos/embed/0X9FI2O7
    {
      type: 'scatter',
      title: {
        text: 'Trigger Mode'
      },
      crosshairX: {
        trigger: 'hover', //'move' (default) or 'hover'
        plotLabel: {
          text: '%vv bubbles at %kv',
          transform: {
            type: 'date',
            all: '%g:%i %a'
          }
        }
      },
      scaleX: {
        minValue: 1451606436000,
        maxValue: 1451692836000,
        step: 'hour',
        transform: {
          type: 'date',
          all: '%g %a'
        },
        maxItems: 9,
        item: {
          fontSize: 10
        }
      },
      utc: true,
      plot: {
        tooltip: {
          visible: false
        },
        marker: {
          backgroundColor: '#66CCFF #FFCCFF',
          size: 7
        }
      },
      series: [{
        values: [
          //Omitted for brevity.
        ]
      }]
    }
    

    Y-Axis Crosshairs

    You can also add crosshairs on the y-axis, to be used alone or in conjunction with x-axis crosshairs. Create a crosshair-y object. This will cause scale labels to appear, with horizontal lines that span the plot area.

    Note: When working with crosshairs, it is best to disable the tooltips, which appear across our charting library by default. In the plot object, create a tooltip object. Add a visible attribute, and set the value to false.

    https://app.zingsoft.com/demos/embed/P2OTZ98D
    https://app.zingsoft.com/demos/embed/P2OTZ98D
    {
      type: 'line',
      crosshairY: {
    
      },
      plot: {
        tooltip: {
          visible: false
        }
      },
      series: [{
        values: [20, 40, 25, 50, 15, 45, 33, 34, 49, 53, 19, 35, 24],
        text: 'Blueberries'
      }, {
        values: [11, 30, 21, 18, 59, 50, 28, 33, 23, 15, 18, 26, 34],
        text: 'Cherries'
      }, {
        values: [30, 21, 18, 21, 33, 41, 29, 15, 11, 12, 26, 23, 26],
        text: 'Kiwis'
      }, {
        values: [34, 16, 26, 15, 19, 21, 20, 24, 35, 41, 42, 38, 39],
        text: 'Kumquats'
      }]
    }
    

    With y-axis crosshairs, you can customize the appearance of the scale labels and crosshair lines. You can also change the type mode to show single (default) or multiple (to correspond to the number of series in the chart) y-axis crosshairs. (The multiple option is especially useful to pinpoint data points using simultaneous x- and y-axis crosshairs.) You can browse our Crosshairs JSON page for a full list of attribute options.

    Scale Labels

    To customize the scale labels, create a scale-label object in crosshair-y. You'll place applicable attributes in this object. Refer to the Crosshair Scale Labels JSON page for more information.

    Note: You can also turn off the visibility of the scale labels by adding a visible attribute to the scale-label object and setting the value to false.

    crosshairY: {
      scaleLabel: {
        //Place applicable attributes here.
      },
      ...
    }
    

    Styling

    When styling your scale labels, use attributes such as font-color, font-family, font-size, background-color, border-width, border-color, line-style, border-radius, padding, and more. See the Crosshair Scale Labels JSON page for a full attribute list.

    https://app.zingsoft.com/demos/embed/2U0GJBJZ
    https://app.zingsoft.com/demos/embed/2U0GJBJZ
    {
      type: 'line',
      crosshairY: {
        scaleLabel: {
          fontColor: '#6600ff',
          fontFamily: 'Georgia',
          fontSize: 12,
          backgroundColor: 'pink yellow',
          borderWidth: '1px',
          borderColor: '#6600ff',
          lineStyle: 'dashdot',
          borderRadius: '10px',
          padding: '10%'
        }
      },
      plot: {
        tooltip: {
          visible: false
        }
      },
      series: [{
        values: [20, 40, 25, 50, 15, 45, 33, 34, 49, 53, 19, 35, 24],
        text: 'Blueberries'
      }, {
        values: [11, 30, 21, 18, 59, 50, 28, 33, 23, 15, 18, 26, 34],
        text: 'Cherries'
      }, {
        values: [30, 21, 18, 21, 33, 41, 29, 15, 11, 12, 26, 23, 26],
        text: 'Kiwis'
      }, {
        values: [34, 16, 26, 15, 19, 21, 20, 24, 35, 41, 42, 38, 39],
        text: 'Kumquats'
      }]
    }
    

    Crosshair Lines

    When styling the crosshair lines, use attributes such as line-color, line-width, and line-style (dotted, dashed, dashdot, solid) to the crosshair-y object.

    https://app.zingsoft.com/demos/embed/0T5HIO94
    https://app.zingsoft.com/demos/embed/0T5HIO94
    {
      type: 'line',
      crosshairY: {
        lineColor: '#6600ff',
        lineWidth: '2px',
        lineStyle: 'dashdot'
      },
      plot: {
        tooltip: {
          visible: false
        }
      },
      series: [{
        values: [20, 40, 25, 50, 15, 45, 33, 34, 49, 53, 19, 35, 24],
        text: 'Blueberries'
      }, {
        values: [11, 30, 21, 18, 59, 50, 28, 33, 23, 15, 18, 26, 34],
        text: 'Cherries'
      }, {
        values: [30, 21, 18, 21, 33, 41, 29, 15, 11, 12, 26, 23, 26],
        text: 'Kiwis'
      }, {
        values: [34, 16, 26, 15, 19, 21, 20, 24, 35, 41, 42, 38, 39],
        text: 'Kumquats'
      }]
    }
    

    Type Mode

    By default, y-axis crosshairs appear as a sliding ruler, following the user's mouse movements. You can change the type mode so that it acts as a precise pinpoint, meeting with the corresponding x-axis crosshairs at the nearest data points (or node values). In the crosshair-y object, add a type attribute. Set the value to multiple. See the following examples.

    Note: Both crosshair-x and crosshair-y objects must be included in your chart object for the multiple type mode to properly activate.

    https://app.zingsoft.com/demos/embed/ZITQ4OPE
    https://app.zingsoft.com/demos/embed/ZITQ4OPE
    {
      type: 'line',
      crosshairX: {
    
      },
      crosshairY: {
        type: 'multiple' //'single' (default) or 'multiple'
      },
      plot: {
        tooltip: {
          visible: false
        }
      },
      series: [{
        values: [20, 40, 25, 50, 15, 45, 33, 34, 49, 53, 19, 35, 24],
        text: 'Blueberries'
      }, {
        values: [11, 30, 21, 18, 59, 50, 28, 33, 23, 15, 18, 26, 34],
        text: 'Cherries'
      }, {
        values: [30, 21, 18, 21, 33, 41, 29, 15, 11, 12, 26, 23, 26],
        text: 'Kiwis'
      }, {
        values: [34, 16, 26, 15, 19, 21, 20, 24, 35, 41, 42, 38, 39],
        text: 'Kumquats'
      }]
    }
    

    This chart consists of a single series, using array of arrays data. Notice how the visibility of both the x- and y-axis crosshair scale labels was turned off.

    https://app.zingsoft.com/demos/embed/N00GWAVH
    https://app.zingsoft.com/demos/embed/N00GWAVH
    {
      type: 'scatter',
      title: {
        text: 'Scatter Plot'
      },
      crosshairX: {
        plotLabel: {
          text: 'X: %kv<br>Y: %vv',
          multiple: true,
          padding: '10%',
          borderRadius: '5px'
        },
        scaleLabel: {
          visible: false
        }
      },
      crosshairY: {
        type: 'multiple', //'single' (default) or 'multiple'
        scaleLabel: {
          visible: false
        }
      },
      plot: {
        tooltip: {
          visible: false
        },
        marker: {
          rules: [{
            rule: '%v < 20',
            backgroundColor: '#003399'
          }, {
            rule: '%v >= 20 && %v <= 40',
            backgroundColor: '#3366cc'
          }, {
            rule: '%v >= 40 && %v <= 60',
            backgroundColor: '#009999'
          }, {
            rule: '%v >= 60 && %v <= 80',
            backgroundColor: '#00cc99'
          }, {
            rule: '%v > 80',
            backgroundColor: '#ccccff'
          }]
        }
      },
      series: [{
        values: [
          //Omitted for brevity.
        ]
      }]
    }
    

    This chart consists of a single series, using time-series data. Notice how the visibility of both the x- and y-axis crosshair scale labels was turned off.

    https://app.zingsoft.com/demos/embed/E35JS3JN
    https://app.zingsoft.com/demos/embed/E35JS3JN
    {
      type: 'stock',
      title: {
        text: 'Candlestick Chart'
      },
      crosshairX: {
        plotLabel: {
          text: '%kv:<br><br>Open: $%open<br>High: $%high<br>Low: $%low<br>Close: $%close',
          decimals: 2,
          transform: {
            type: 'date',
            all: '%M %d, %Y'
          },
          multiple: true,
          padding: '10%',
          borderRadius: '5px'
        },
        scaleLabel: {
          visible: false
        }
      },
      crosshairY: {
        type: 'multiple', //'single' (default) or 'multiple'
        scaleLabel: {
          visible: false
        }
      },
      scaleX: {
        minValue: 1420232400000,
        step: 'day',
        transform: {
          type: 'date',
          all: '%D,<br>%m/%d'
        },
        maxItems: 10,
        item: {
          fontSize: 10
        }
      },
      scaleY: {
        values: '25:35:1',
        format: '$%v',
        guide: {
          lineStyle: 'solid'
        },
        item: {
          fontSize: 10
        }
      },
      plot: {
        aspect: 'candlestick',
        tooltip: {
          visible: false
        },
        trendUp: {
          backgroundColor: '#66ccff',
          lineColor: 'black',
          borderColor: 'black'
        },
        trendDown: {
          backgroundColor: '#ff3300',
          lineColor: 'black',
          borderColor: 'black'
        }
      },
      series: [{
        values: [
          //Omitted for brevity.
        ]
      }]
    }
    

    Positioning with Top Layer

    By default, when crosshair(s) and legend are both enabled the crosshairs are painted over the legend. To have the crosshair lines appear behind the legend, set the topLayer attribute to 'legend'.

    https://app.zingsoft.com/demos/embed/IW46KARU
    https://app.zingsoft.com/demos/embed/IW46KARU
    {
      type: 'bar',
      topLayer: 'legend',
      ...
    }
    

    Summary

    Crosshairs appear when hovering on a chart. Similar to a tooltip, the crosshair displays data for a specific point, but unlike tooltips, you don't need to hover directly over the node to display it. Additionally, crosshairs highlight the scale value attached to the node with both a scale label and a line marker drawn from the "hovered" node to the scale. They are useful for continuous values.

    For a full list of crosshair attributes, see the JSON configuration page.