There is a way to get the x axis value of a point with line chart ?
See original GitHub issueHi,
First, thanks a lot for your beautiful project !
I’m wondering if there is a way to get the x axis label where a ct:point is located in ? I’m using the line chart with tooltips for each point. The documentation shows how to get the y axis value and the serie name but I’m looking for the x axis value.
Here an example of what I’m looking for.
I don’t know what to write in '???'
$chart.on('mouseenter', '.ct-point', function() {
var point = $(this),
value = point.attr('ct:value'),
seriesName = point.parent().attr('ct:series-name')
x_axis_value = '???';
$toolTip.html(seriesName + '<br>' + x_axis_value + ' = ' + value).show();
});
Thanks for the help !
Issue Analytics
- State:
- Created 9 years ago
- Comments:6
Top Results From Across the Web
A Complete Guide to Line Charts | Tutorial by Chartio
Line charts are a fundamental chart type generally used to show change in values across time. Learn how to best use this chart...
Read more >Change the display of chart axes - Microsoft Support
Display or hide axes, or change other aspects of a chart axes in Excel, Word, Outlook, or PowerPoint.
Read more >Is there a way to show only specific values in x-axis of an ...
You can either: 1) Use a line chart, which treats the horizontal axis as categories (rather than quantities). 2) Use an XY/Scatter plot, ......
Read more >Do we have a way to know the X Axis value of first point in line ...
You can use the following code to get the min and max value. var dg = (XYDiagram)chartControl1.Diagram; var minXValue = dg.AxisX.WholeRange.
Read more >How to Make a Graph on Excel With X & Y Coordinates
1. Select your data, and click Insert - Scatter or Bubble Chart - Scatter with Straight Lines. · 2. You can see that...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Raphy you can now use the meta data feature included in 0.6.0 for this.
There will be an additional
ct:meta
attribute on the points of line charts or on the bars of bar charts. You can also add the whole tooltip text to the meta property. It also accepts objects / complex types. Objects will be serialized and need to be deserialized when you read them from the attributes with http://gionkunz.github.io/chartist-js/api-documentation.html#chartistcore-method-deserializeHope this helps. Cheers Gion
I know this is closed, but is there a way to do this if you are unable to add meta to the data series? I’m handling an object that I can’t alter and it’s coming to me where key/value = x lables/point values.
const chart{{ $id }} = new Chartist.Line('#{{ $id }}', { labels: {!! json_encode($hours) !!}, series: [ { name: 'audience by time', data: {!! json_encode($values) !!} } ] }