PDA

View Full Version : Category Series not grouping Data



alex9311
23 Jan 2013, 5:24 PM
I have a category axis with letter grades as the field. I want the axis to create one hashmark per grade. All rows with the letter grade "C" will be plotted on the same C on the category axis. Right now, a new hasmark is made for each row in my store, even if it is a multiple. See picture below if this doesnt make sense. How can I get the category axis to group its values?

thanks!

UPDATE:
I'm trying to do this with a category axis. Here is my store code:


Ext.define('PL.store.Plot', {
extend: 'Ext.data.Store',
model: 'PL.model.Plot',
data:[
{grade:'A', firstaction:98},
{grade:'B', firstaction:97},
{grade:'D', firstaction:46},
{grade:'C', firstaction:84},
{grade:'F', firstaction:30},
{grade:'F', firstaction:50},
],
groupField:'grade',
sorters:[{
property: 'grade',
direction: 'DESC'
}]
});

And my axes code:

axes: [{
type: 'Category',
//minimum: 0,
position: 'left',
fields: ['grade'],
title: 'Midterm 1 Grade',
},{
type: 'Numeric',
position: 'bottom',
fields: ['firstaction'],
title: 'Total Course Visits',
}],


The issue is that the rows with the same 'grade' are not being grouped together on the Y-axis on my chart. See how there are two 'F' categories on the y-axis? I would like those two rows to be grouped in the chart so they appear on the same height

41514

croisez
12 Mar 2013, 5:41 AM
Same problem for me:
I want to plot the response to a question, with:


var chartData = Ext.create('Ext.data.JsonStore', {
fields: ['date','response'],
data:[
{response:"no",date:new Date("2013-03-08T00:00:00.000Z")},
{response:"sė",date:new Date("2013-03-06T00:00:00.000Z")},
{response:"sė",date:new Date("2013-03-04T00:00:00.000Z")},
{response:"no",date:new Date("2013-03-01T00:00:00.000Z")},
{response:"sė",date:new Date("2013-02-27T00:00:00.000Z")},
{response:"no",date:new Date("2013-02-25T00:00:00.000Z")},
{response:"no",date:new Date("2013-02-22T00:00:00.000Z")},
{response:"no",date:new Date("2013-02-20T00:00:00.000Z")},
{response:"no",date:new Date("2013-02-18T00:00:00.000Z")},
{response:"no",date:new Date("2013-02-15T00:00:00.000Z")},
{response:"no",date:new Date("2013-02-13T00:00:00.000Z")},
{response:"no",date:new Date("2013-02-11T00:00:00.000Z")}
],
});

Ext.create('Ext.chart.Chart', {
axes: [
{
title: 'Response',
type: 'Category',
position: 'left',
fields: ['response'],
grid: true,
},
{
title: 'Time',
type: 'Time',
position: 'bottom',
fields: ['date'],
dateFormat: 'd M',
label: { rotate: { degrees: 315 } },
grid: true,
}
],

series: [
{
type: 'scatter',
xField: 'date',
yField: 'response',
markerConfig: {
type: 'circle',
radius: 2,
size: 2
},
}
],

renderTo: Ext.getBody(),
width: 500,
height: 300,
store: chartData
});

On the Y axis, I only would like to get one instance of each response: "no", "si".

I can't find any example that suit this requirement :(

Any help would be great

Daniil
6 Aug 2013, 11:11 PM
Here I am trying to come up with a solution for that problem.
http://www.sencha.com/forum/showthread.php?269450