ExtJs 4.1.1 chart missing markers - extjs

I spent days trying to solve this one:
I'm trying to create a chart with several series. In one series I show a line with all points (in my code "val" series). In the second series I wish to show only part of the points ("temperature" series). Both series are showing a data type of int.
I tried to set a very low value to the "temperature" field in order to omit it from the chart but it also caused the respective "val" to be skipped!
In ExtJs 4.1.1: The 10am value of the "val" field is skipped.
In ExtJs 4.0.7: The 10am value of the "val" field exists!
(I wish I could post images here but I do not have 10 reputation points.:-( )
Here is my code:
Ext.define('WeatherPoint', {
extend: 'Ext.data.Model',
fields: ['temperature', 'date', 'val']
});
var store1 = Ext.create('Ext.data.Store', {
model: 'WeatherPoint',
data: [
{ temperature: 58, date: new Date(2011, 1, 1, 8), val: 10 },
{ temperature: 63, date: new Date(2011, 1, 1, 9), val: 20 },
{ temperature: -100, date: new Date(2011, 1, 1, 10), val: 40 },
{ temperature: 78, date: new Date(2011, 1, 1, 11), val: 90 },
{ temperature: 81, date: new Date(2011, 1, 1, 12), val: 50 }
]
});
var chart1 = Ext.create('Ext.chart.Chart',{
xtype: 'chart',
animate: false,
store: store1,
legend: true,
insetPadding: 30,
axes: [{
title: 'Temperature',
type: 'Numeric',
position: 'left',
fields: ['temperature', 'val'],
minimum: 0,
maximum: 100
}, {
title: 'Time',
type: 'Time',
position: 'bottom',
fields: ['date'],
dateFormat: 'ga',
step: [Ext.Date.HOUR, 1],
fromDate: new Date(2011, 1, 1, 8),
toDate: new Date(2011, 1, 1, 12)
}],
series: [{
type: 'scatter',
axis: ['left','bottom'],
xField: 'date',
yField: 'temperature'
}, {
type: 'line',
title: 'val',
axis: ['left','bottom'],
xField: 'date',
yField: 'val'
}]
});
var panel1 = Ext.create('widget.panel', {
width: 600,
height: 400,
renderTo: Ext.getBody(),
layout: 'fit',
items: chart1
});
Why 4.1.1 makes all series skip because of a value that is out-of-range in one series?
How can I show only part of the points in one series and all of the point in the second?

Try using null or empty '' values for points you want to hide.
Example:
var store1 = Ext.create('Ext.data.Store', {
model: 'WeatherPoint',
data: [
{ temperature: 58, date: new Date(2011, 1, 1, 8), val: 10 },
{ temperature: 63, date: new Date(2011, 1, 1, 9), val: 20 },
{ temperature: '', date: new Date(2011, 1, 1, 10), val: 40 },
{ temperature: 78, date: new Date(2011, 1, 1, 11), val: ''},
{ temperature: 81, date: new Date(2011, 1, 1, 12), val: 50 }
]
});

Related

how to mix rowspan and expandable rows in ant design table

I want to use both row span and expandable rows from ant design table component
the target table should look something like this:
i am using the following code to generate this table:
const columns = [
{
title: 'Overall',
colSpan: 4,
dataIndex: 'metric',
ellipsis: true,
fixed: 'left',
width: 100,
render: (value, row, index) => {
const obj = {
children: value,
props: {},
};
if (index % 8 === 0) {
obj.props.rowSpan = 8;
} else {
obj.props.rowSpan = 0;
}
return obj;
},
},
{
title: 'Bucket',
colSpan: 0,
dataIndex: 'bucket',
ellipsis: true,
fixed: 'left',
width: 100,
render: (value, row, index) => {
const obj = {
children: value,
props: {},
};
if (index % 2 === 0) {
obj.props.rowSpan = 2;
} else {
obj.props.rowSpan = 0;
}
return obj;
},
},
{
title: 'Target',
colSpan: 0,
dataIndex: 'target',
ellipsis: true,
fixed: 'left',
width: 100,
},
{
title: 'Overall Value',
colSpan: 0,
dataIndex: 'overall_value',
ellipsis: true,
fixed: 'left',
width: 100,
},
{
title: '2019-01-01',
dataIndex: '2019-01-01',
ellipsis: true,
width: 100,
},
{
title: '2019-01-02',
dataIndex: '2019-01-02',
ellipsis: true,
width: 100,
},
{
title: '2019-01-03',
dataIndex: '2019-01-03',
ellipsis: true,
width: 100,
},
{
title: '2019-01-04',
dataIndex: '2019-01-04',
ellipsis: true,
width: 100,
},
{
title: '2019-01-05',
dataIndex: '2019-01-05',
ellipsis: true,
width: 100,
},
];
const data = [
{
key: '1',
metric: 'ALBS',
bucket: 'Overall',
target: 'Actual',
overall_value: 4781,
'2019-01-01': 213,
'2019-01-02': 21,
'2019-01-03': 23,
'2019-01-04': 13,
'2019-01-05': 35,
},
{
key: '2',
metric: 'ALBS',
bucket: 'Overall',
target: '1 Year Ago',
overall_value: 4781,
'2019-01-01': 213,
'2019-01-02': 21,
'2019-01-03': 23,
'2019-01-04': 13,
'2019-01-05': 35,
children: [
{
key: '3',
metric: 'ALBS',
bucket: 'Shanghai',
target: 'Actual',
overall_value: 4781,
'2019-01-01': 213,
'2019-01-02': 21,
'2019-01-03': 23,
'2019-01-04': 13,
'2019-01-05': 35,
},
{
key: '4',
metric: 'ALBS',
bucket: 'Shanghai',
target: '1 Year Ago',
overall_value: 4781,
'2019-01-01': 213,
'2019-01-02': 21,
'2019-01-03': 23,
'2019-01-04': 13,
'2019-01-05': 35,
},
{
key: '5',
metric: 'ALBS',
bucket: 'Peking',
target: 'Actual',
overall_value: 4781,
'2019-01-01': 213,
'2019-01-02': 21,
'2019-01-03': 23,
'2019-01-04': 13,
'2019-01-05': 35,
},
{
key: '6',
metric: 'ALBS',
bucket: 'Peking',
target: '1 Year Ago',
overall_value: 4781,
'2019-01-01': 213,
'2019-01-02': 21,
'2019-01-03': 23,
'2019-01-04': 13,
'2019-01-05': 35,
},
{
key: '7',
metric: 'ALBS',
bucket: 'Canton',
target: 'Actual',
overall_value: 4781,
'2019-01-01': 213,
'2019-01-02': 21,
'2019-01-03': 23,
'2019-01-04': 13,
'2019-01-05': 35,
},
{
key: '8',
metric: 'ALBS',
bucket: 'Canton',
target: '1 Year Ago',
overall_value: 4781,
'2019-01-01': 213,
'2019-01-02': 21,
'2019-01-03': 23,
'2019-01-04': 13,
'2019-01-05': 35,
},
]
},
];
const expandable = {
expandIconColumnIndex: 1,
};
return (
<Table columns={columns} size="small" dataSource={data} expandable={expandable} scroll={{ x: true }} bordered defaultExpandAllRows />
);
the table being generated looks something like this:
there are several problems with this table:
the second column messes up the children, somehow it doesn't realise that first column is rendered already
the expand button doesn't get rendered correctly because i am attaching children on (col 2, row 2) instead of (col 2, row 1). but if i attach children on first row, it doesn't realise that every 2 rows should be treated as a group when expanding
any idea how to fix these problems?

RGraph V5 Upgrade - error getting context

I had a working 3d chart using version 2107-10-1 that used images for the y axis.
I'm now trying to use the version 5 libraries but I'm getting an error:
"Cannot read property 'getContext' of null at new RGraph.Drawing.Image (RGraph.drawing.image.js:64)
Which is:
"context = this.canvas.getContext('2d');"
I change the line in the library to 3d to match the chart variant setting of 3d and the error is resolved. However I then get the following errors:
"Cannot set property 'shadowColor' of null
at Object.RG.noShadow.RG.NoShadow (RGraph.common.core.js:5155)
at RGraph.Drawing.Image.draw.Draw (RGraph.drawing.image.js:490)"
I've been going through the API to try and find any differences to the property names but my skill and understanding is not great.
Any help or advice would be greatly appreciated.
:-)
new RGraph.Bar({
id: 'cvs',
data: [ [0,5,5],[0,5,5],[0,5,5] ],
options: {
/******/
variant: '3d',
variantThreedAngle: 0,
hmarginGrouped: 2,
/*****/
textFont: '"Courier New", Courier, monospace',
titleFont: '"Courier New", Courier, monospace',
labels:['Monday', 'Saturday', 'Sunday'] ,
colors: [ '#3cb44b','#5484ed','#fbd75b' ],
textSize: 11,
title: 'Test Learner1: T1C1 W/B 22nd April 2019',
titleSize: 11,
titleColor:'#338833',
titleX: 50,
titleY: 25,
titleHalign: 'Left',
textAccessible: false,
key: ['LabelOne','LabelTwo','LabelThree'], //['One','Two','Three','Four','Five'],
keyPositionY: 470,
keyPositionX: 0,
gutterBottom: 65,
gutterRight: 10,
gutterTop: 40,
gutterLeft: 70,
keyPosition: 'gutter',
keyTextSize: 9,
numyticks: 2,
ylabelsCount: 2,
ymax: 10,
ymin: 0,
backgroundColor: 'white',
labelsColor: 'green'
// end options
}
}).draw().exec(function (obj)
{
var images = [
'smileyimages/graphimages/smiley5.png','smileyimages/graphimages/smiley10.png','smileyimages/graphimages/smiley1.png',
];
var index = 0;
obj.coordsText.forEach(function (val, key, arr)
{
if (val.tag === 'scale') {
var x = val.x,
y = val.y,
text = val.text;
var img = new RGraph.Drawing.Image({
id: 'cvs',
x: x,
y: y,
src: images[index],
options: {
halign: 'right',
valign: 'center'
}
}).draw();
index++;
}
});
obj.set({
ylabels: true
});
RGraph.redraw();
}).on('beforedraw', function (obj)
{
RGraph.clear(obj.canvas, 'white');
});
I've adjusted your code for the new property names. With this code remember to update the paths to the images.
<script src="/libraries/RGraph.drawing.image.js"></script>
<script src="/libraries/RGraph.common.core.js"></script>
<script src="/libraries/RGraph.common.key.js"></script>
<script src="/libraries/RGraph.bar.js"></script>
And the code that makes the chart:
new RGraph.Bar({
id: 'cvs',
data: [ [1,5,5],[1,5,5],[1,5,5] ],
options: {
variant: '3d',
hmargin: 20,
hmarginGrouped: 2,
textFont: '"Courier New", Courier, monospace',
titleFont: '"Courier New", Courier, monospace',
xaxis: false,
xaxisLabels:['Monday', 'Saturday', 'Sunday'] ,
colors: [ '#3cb44b','#5484ed','#fbd75b' ],
title: 'Test Learner1: T1C1 W/B 22nd April 2019',
titleX: 120,
titleY: 25,
titleHalign: 'Left',
textAccessible: false,
key: ['LabelOne','LabelTwo','LabelThree'], //['One','Two','Three','Four','Five'],
keyPositionY: 435,
keyPositionX: 100,
marginBottom: 95,
marginRight: 10,
marginTop: 40,
marginLeft: 100,
keyPosition: 'margin',
keyLabelsSize: 9,
yaxis: false,
yaxisLabelsCount: 2,
yaxisScaleMax: 10,
yaxisScaleMin: 0,
backgroundColor: 'white',
xaxisLabelsColor: 'green'
}
}).draw().exec(function (obj)
{
var images = [
'/images/alex.png',
'/images/alert.png',
'/images/facebook.png'
];
var index = 0;
obj.coordsText.forEach(function (val, key, arr)
{
if (val.tag === 'scale') {
var x = val.x,
y = val.y,
text = val.text;
var img = new RGraph.Drawing.Image({
id: 'cvs',
x: x,
y: y + 10,
src: images[index++],
options: {
halign: 'right',
valign: 'center'
}
}).draw();
}
});
});

extjs 4Uncaught TypeError: Cannot read property 'items' of undefined

i want load a chart with store and model by sample data.But when loading data get a error: Cannot read property 'items' of undefined
i creating a store and model in conroller and set chart values:
var chart = Ext.create('Ext.chart.Chart', {
animate: true,
store: Ext.create('Ext.data.Store', {
model: Ext.create('Ext.data.Model', {
fields: ['temperature', 'date']
}
),
data: [
{temperature: 58, date: new Date(2011, 1, 1, 8)},
{temperature: 63, date: new Date(2011, 1, 1, 9)},
{temperature: 73, date: new Date(2011, 1, 1, 10)},
{temperature: 78, date: new Date(2011, 1, 1, 11)},
{temperature: 81, date: new Date(2011, 1, 1, 12)}
]
}),
axes: [{
type: 'numeric',
position: 'left',
title: 'y',
minimum: 0
},
{
type: 'date',
position: 'bottom',
title: 'x',
minimum: 0
}],
series: [{
type: 'column',
axis: 'left',
highlight: true,
tips: {
trackMouse: true,
width: 140,
height: 28
}
},
{
label: {
display: 'insideEnd',
'text-anchor': 'middle',
renderer: Ext.util.Format.numberRenderer('0'),
orientation: 'vertical',
color: '#333'
},
}
],
});
and i want add this chart to panel
Ext.ComponentQuery.query('panel')[0].add(chart);
Cannot read property 'items' of undefined is coming as you are directly creating instance of model with out defining .
Here is the fiddle http://jsfiddle.net/djaydxnd/66/
store: Ext.create('Ext.data.Store', {
model:Ext.define('chart', {
extend: 'Ext.data.Model',
fields: ['temperature','date']
}),
data: [
{temperature: 58, date: new Date(2011, 1, 1, 8)},
{temperature: 63, date: new Date(2011, 1, 1, 9)},
{temperature: 73, date: new Date(2011, 1, 1, 10)},
{temperature: 78, date: new Date(2011, 1, 1, 11)},
{temperature: 81, date: new Date(2011, 1, 1, 12)}
]
})

Angular gantt customize data fields

Does angular gantt plugin allow to change the column header labels? I tried to change the side table headers but couldn't. If it doesn't allow what other gantt chart can I use? At the side table, I need to show work station, id and type. In the gannt chart, I need to show the particular ids under the respective priority numbers. Any suggestions, please?
You can change or defined the column header labels at property Options.
$scope.options = {
...
treeTableColumns: ['from', 'to', 'myColumn'],
columnsHeaders: { 'model.name': 'Name', 'from': 'From', 'to': 'To', 'myColumn': 'My column name' },
columnsClasses: { //css
'myColumn': 'myclass'
},
//defined content here. ex: String, checkbox, radio, ...
//ex: <input type="checkbox" id={{row.model.id}} ng-model="row.model.myColumn">
columnsContents: {
'myColumn': '{{row.model.myColumn}}',
...
},
};
$scope.myData = [{
id: 1,
name: 'Finalize concept',
myColumn: 'content',
tasks: [{
id: 'Finalize concept',
name: 'Finalize concept',
priority: 10,
color: '#F1C232',
from: new Date(2013, 9, 17, 8, 0, 0),
to: new Date(2013, 9, 18, 18, 0, 0),
progress: 100
}]
}, {
id: 2,
name: 'Development',
myColumn: 'content',
children: ['Sprint 1', 'Sprint 2', 'Sprint 3', 'Sprint 4'],
content: '<i class="fa fa-file-code-o" ng-click="scope.handleRowIconClick(row.model)"></i> {{row.model.name}}'
} ]
https://www.angular-gantt.com/configuration/attributes/
Here yo have the answer about all you can do.
You cant change the column header labels but you can select between all the formats that you have:
$scope.headersFormats = {
'year': 'YYYY',
'quarter': '[Q]Q YYYY',
month: 'MMMM YYYY',
week: 'w',
day: 'D',
hour: 'H',
minute:'HH:mm'
};

Highcharts - Passing Data for Flags in Array. It is not rendered

I am trying to render 3 flags (experimenting with flags) in a candlestick chart in Highchart, but the flag {x: Date.UTC(2012, 7, 6),title: 'On series'}
Is not getting rendered. Why?
$(function() {
$.getJSON('http://www.highcharts.com/samples/data/jsonp.php?filename=aapl-ohlcv.json&callback=?', function(data) {
// split the data set into ohlc and volume
var ohlc = [],
volume = [],
dataLength = data.length,
arrflag =[
{x: Date.UTC(2012, 7, 17),title: 'On series'},
{x: Date.UTC(2012, 7, 9),title: 'On series'}
];
arrflag.push([
{x: Date.UTC(2012, 7, 6),title: 'On series'}
]);
for (i = 0; i < dataLength; i++) {
ohlc.push([
data[i][0], // the date
data[i][1], // open
data[i][2], // high
data[i][3], // low
data[i][4] // close
]);
volume.push([
data[i][0], // the date
data[i][5] // the volume
])
}
// set the allowed units for data grouping
var groupingUnits = [[
'week', // unit name
[1] // allowed multiples
], [
'month',
[1, 2, 3, 4, 6]
]];
// create the chart
chart = new Highcharts.StockChart({
chart: {
renderTo: 'container',
alignTicks: false
},
rangeSelector: {
selected: 0
},
title: {
text: 'AAPL Historical'
},
yAxis: [{
title: {
text: 'OHLC'
},
height: 200,
lineWidth: 2
}, {
title: {
text: 'Volume'
},
top: 300,
height: 100,
offset: 0,
lineWidth: 2
}],
series: [{
type: 'candlestick',
name: 'AAPL',
id: 'AAPLX',
data: ohlc,
dataGrouping: {
units: groupingUnits
}
}, {
type: 'column',
name: 'Volume',
data: volume,
yAxis: 1,
dataGrouping: {
units: groupingUnits
}
},{
type: 'flags',
name: 'Flags on series',
data: arrflag,
onSeries: 'AAPLX',
shape: 'squarepin'
}]
});
});
});​
Live DEMO
You array of flags has the following value:
arrflag =[
{x: Date.UTC(2012, 7, 17),title: 'On series'},
{x: Date.UTC(2012, 7, 9),title: 'On series'}
];
When you push the other flag you add it to another array, which isn't the expected. So the result will be.
arrflag =[
{x: Date.UTC(2012, 7, 17),title: 'On series'},
{x: Date.UTC(2012, 7, 9),title: 'On series'},
[{x: Date.UTC(2012, 7, 6),title: 'On series'}]
];
Remove [ and ] from the following code.
arrflag.push([
{x: Date.UTC(2012, 7, 6),title: 'On series'}
]);

Resources