0
votes

this is my first post so please excuse me if I missed anything.

I'm trying to build an elevation profile chart in amcharets using its XY chart. The data will look like below, where distance will be the X value, and two elevations will be the Y value as two line series.

[
{distance: 1.0, elevation1: 10.1, elevation2: 5.2},
{distance: 1.3, elevation1: 10.5, elevation2: 5.1},
{distance: 1.4, elevation1: 10.2, elevation2: 5.5},
{distance: 2.0, elevation1: 10.3, elevation2: 5.6},
{distance: 2.6, elevation1: 10.5, elevation2: 5.7},
{distance: 2.7, elevation1: 10.9, elevation2: 5.9},
{distance: 3.3, elevation1: 11.1, elevation2: 5.8},

]

In amcharts when using Date Axis or Category Axis as X-axis, it will show tooltips of all series when moving the cursor over the chart, if the series has a Y value for a given X value. However I couldn’t use either because in my case my X values are not equally distributed but have this linear relationship. E.g. the if the x value (distance) = 1.3, it should sit at 3/10 between the 1 and 2 marker. But if I use ValueAxis as the X-axis, the chart won't show the series tooltip at all. So my question is, whether there's a way to allow the chart to show series tooltip even if the x-axis is ValueAxis, or if there’s a way in amcharts allow me to build such type of chart with tooltip turned on. Thank you.

2

2 Answers

0
votes

When both x and y axes are Value axes, you can make the cursor to snap to the nearest data point by setting:

chart.cursor.snapToSeries = series

Like in this demo: https://www.amcharts.com/demos/zoomable-bubble-chart/

0
votes

Similar question It use bullets Amcharts 4: How to combine tooltips of LineSeries

I change example, where bullets is invisible, make radius to 0

bullet1.circle.radius = 0;

https://codepen.io/team/amcharts/pen/a9c1d3eff9170c04f18e134bd6940daa?editors=0010