View Full Version : How to fetch x-axis and y-axis data in in line chart

29 Nov 2011, 5:49 AM
Hi All,

Can anyone please guide me on how to access axes data on a line chart.
I have created a line chart. When I hover on any of the circles on the line it displays me x and y axis data. I want to fetch those data in any variable so that i could forward it for any further processing.
Below is my code:
Html code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="ext-3.4.0/resources/css/ext-all.css" />

<script type="text/javascript" src="ext-3.4.0/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="ext-3.4.0/ext-all.js"></script>
<script type="text/javascript" src="charts.js"></script>

<h1>Yield Curve</h1>
<div id="container"></div>

ExtJs code:

Ext.chart.Chart.CHART_URL = 'ext-3.4.0/resources/charts.swf';


var store = new Ext.data.JsonStore({
fields:['name', 'visits', 'views'],
data: [
{name:'Jul 07', visits: 245000, views: 3000000},
{name:'Aug 07', visits: 240000, views: 3500000},
{name:'Sep 07', visits: 355000, views: 4000000},
{name:'Oct 07', visits: 375000, views: 4200000},
{name:'Nov 07', visits: 490000, views: 4500000},
{name:'Dec 07', visits: 495000, views: 5800000},
{name:'Jan 08', visits: 520000, views: 6000000},
{name:'Feb 08', visits: 620000, views: 7500000}

new Ext.Panel({
title: 'Yield Curve Graph',
renderTo: 'container',

items: {
xtype: 'linechart',
store: store,
xField: 'name',
yField: 'visits'

Please help on above.

Thanks in advance.

29 Nov 2011, 2:40 PM
You can get the xField and yField from the chart and then you can iterate through the store and build an array/object/whatever based on those fields. The data is in the store.

30 Nov 2011, 1:35 AM
Thanks for quick response.
I have a doubt here.How will I get the data from line chart. Seems entire chart processing is been done inside .swf file. Is there any method using which I can fetch the data which gets displayed on mouse hover(on line graph).

Please advice.