Styling features based on attribute values - openlayers-3

How does one style features based on attributes/properties? Currently I am doing the following:
olLayer = new ol.layer.Vector( {
source: new ol.source.Vector( {
features: featureArray
} ),
style: ( function() {
var styleR3 = new ol.style.Style( {
image: new ol.style.Circle( {
radius: 10,
fill: new ol.style.Fill( {
color: 'blue'
} )
} )
} );
var styleCatchAll = new ol.style.Style( {
image: new ol.style.Circle( {
radius: 5,
fill: new ol.style.Fill( {
color: 'red'
} )
} )
} );
return function( feature, resolution ) {
if ( feature.attributes[ "Rank" ] === "3" ) {
return styleR3;
} else {
return styleCatchAll;
}
};
}() )
} );
The select features does work but the styleR3 does not get applied.

Here it is ... http://jsfiddle.net/jonataswalker/g3s96auc/
The style function requires an array on return, and you are using a self execution function, I don't know if this works, anyway, the style function became:
style: function(feature, resolution){
var styleR3 = new ol.style.Style( {
image: new ol.style.Circle( {
radius: 10,
fill: new ol.style.Fill( {
color: 'blue'
} )
} )
} );
var styleCatchAll = new ol.style.Style( {
image: new ol.style.Circle( {
radius: 5,
fill: new ol.style.Fill( {
color: 'red'
} )
} )
} );
if ( feature.get('rank') == 3) {
return [styleR3];
} else {
return [styleCatchAll];
}
}

Related

Flutter application crashes at startup on iPhone

I wrote a basic calculator app with flutter and installed it on my iphone with Xcode.
I builded the app and trusted the developer in the iPhone settings. But when I want to open the app it crashes after about 2 seconds of my background screen in blurry. I don't know what is wrong the app runs on the simulator. I don't know if the code is to bad written or if I missed some configuration steps. Has somebody experience with that...
Thank you for your help.
Device Log/ Crash:
{
"crashReporterKey" : "771e2f68485128ac7de5b4f2d3a557289be32a15",
"kernel" : "Darwin Kernel Version 20.0.0: Fri Aug 28 23:07:00 PDT 2020; root:xnu-7195.0.46~9\/RELEASE_ARM64_T8020",
"product" : "iPhone11,2",
"incident" : "E2C76AF9-8284-47F9-962E-FE6DB1D9AD19",
"date" : "2020-09-28 21:24:44.54 +0200",
"build" : "iPhone OS 14.0.1 (18A393)",
"timeDelta" : 6,
"memoryStatus" : {
"compressorSize" : 29314,
"compressions" : 1810481,
"decompressions" : 1202975,
"zoneMapCap" : 1454407680,
"largestZone" : "APFS_4K_OBJS",
"largestZoneSize" : 35880960,
"pageSize" : 16384,
"uncompressed" : 79755,
"zoneMapSize" : 162873344,
"memoryPages" : {
"active" : 75993,
"throttled" : 0,
Flutter Code
import 'package:flutter/material.dart';
void main() {
runApp(Calculator());
}
class Calculator extends StatefulWidget {
#override
_CalculatorState createState() => _CalculatorState();
}
class _CalculatorState extends State<Calculator> {
String _num1 = "";
String _operator = "";
String _num2 = "";
String _show = "";
bool _set_show_to_none = false;
bool _isNum2 = false;
void press_0_button_num1() {
setState(() {
_num1 += "0";
_show += "0";
});
}
void press_1_button_num1() {
setState(() {
_num1 += "1";
_show += "1";
});
}
void press_2_button_num1() {
setState(() {
_num1 += "2";
_show += "2";
});
}
void press_3_button_num1() {
setState(() {
_num1 += "3";
_show += "3";
});
}
void press_4_button_num1() {
setState(() {
_num1 += "4";
_show += "4";
});
}
void press_5_button_num1() {
setState(() {
_num1 += "5";
_show += "5";
});
}
void press_6_button_num1() {
setState(() {
_num1 += "6";
_show += "6";
});
}
void press_7_button_num1() {
setState(() {
_num1 += "7";
_show += "7";
});
}
void press_8_button_num1() {
setState(() {
_num1 += "8";
_show += "8";
});
}
void press_9_button_num1() {
setState(() {
_num1 += "9";
_show += "9";
});
}
void press_0_button_num2() {
setState(() {
if (_set_show_to_none){
_show = "";}
_num2 += "0";
_show += "0";
_set_show_to_none = false;
});
}
void press_1_button_num2() {
setState(() {
if (_set_show_to_none){
_show = "";}
_num2 += "1";
_show += "1";
_set_show_to_none = false;
});
}
void press_2_button_num2() {
setState(() {
if (_set_show_to_none){
_show = "";}
_num2 += "2";
_show += "2";
_set_show_to_none = false;
});
}
void press_3_button_num2() {
setState(() {
if (_set_show_to_none){
_show = "";}
_num2 += "3";
_show += "3";
_set_show_to_none = false;
});
}
void press_4_button_num2() {
setState(() {
if (_set_show_to_none){
_show = "";}
_num2 += "4";
_show += "4";
_set_show_to_none = false;
});
}
void press_5_button_num2() {
setState(() {
if (_set_show_to_none){
_show = "";}
_num2 += "5";
_show += "5";
_set_show_to_none = false;
});
}
void press_6_button_num2() {
setState(() {
if (_set_show_to_none){
_show = "";}
_num2 += "6";
_show += "6";
_set_show_to_none = false;
});
}
void press_7_button_num2() {
setState(() {
if (_set_show_to_none){
_show = "";}
_num2 += "7";
_show += "7";
_set_show_to_none = false;
});
}
void press_8_button_num2() {
setState(() {
if (_set_show_to_none){
_show = "";}
_num2 += "8";
_show += "8";
_set_show_to_none = false;
});
}
void press_9_button_num2() {
setState(() {
if (_set_show_to_none){
_show = "";}
_num2 += "9";
_show += "9";
_set_show_to_none = false;
});
}
void press_plus_button() {
setState(() {
_operator = "+";
_show = "+";
_set_show_to_none = true;
_isNum2 = true;
});
}
void press_minus_button() {
setState(() {
_operator = "-";
_show = "-";
_set_show_to_none = true;
_isNum2 = true;
});
}
void press_multiple_button() {
setState(() {
_operator = "*";
_show = "*";
_set_show_to_none = true;
_isNum2 = true;
});
}
void press_divided_button() {
setState(() {
_operator = "/";
_show = "/";
_set_show_to_none = true;
_isNum2 = true;
});
}
void press_ac_button() {
setState(() {
_num1 = "";
_operator = "";
_num2 = "";
_show = "";
_set_show_to_none = false;
_isNum2 = false;
});
}
void calculate() {
setState(() {
int num1int = int.tryParse(_num1);
int num2int = int.tryParse(_num2);
double num1do = num1int.toDouble();
double num2do = num2int.toDouble();
double result = 0;
if (_operator == "+") {
result = num1do + num2do;
}
else if (_operator == "-") {
result = num1do - num2do;
}
else if (_operator == "*") {
result = num1do * num2do;
}
else if (_operator == "/") {
result = num1do / num2do;
}
RegExp regex = RegExp(r"([.]*0)(?!.*\d)");
String result_output = result.toString().replaceAll(RegExp(r"([.]*0)(?!.*\d)"), "");
_show = result_output;
});
}
#override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
body: Column(
children: <Widget>[
SizedBox(
height: 98,
),
Expanded(
child: Align(
alignment: Alignment.centerRight,
child: Text(_show,
textAlign: TextAlign.right,
style: TextStyle(fontSize: 130)),
),
),
Row(
children: [
Container(
padding: const EdgeInsets.all(10.0),
child: SizedBox(
height: 70,
width: 150,
child: FloatingActionButton.extended(
elevation: 0.2,
onPressed: () {
press_ac_button();
},
label: Text("AC"),
isExtended: true,
),
),
),
],
),
SizedBox(
height: 20,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
SizedBox(
height: 100,
width: 90,
child: FloatingActionButton(
elevation: 0.2,
onPressed: () {
if (_isNum2) {
press_1_button_num2();
} else {
press_1_button_num1();
}
},
child: Text("1"),
),
),
SizedBox(
height: 100,
width: 90,
child: FloatingActionButton(
elevation: 0.2,
onPressed: () {
if (_isNum2) {
press_2_button_num2();
} else {
press_2_button_num1();
}
},
child: Text("2"),
),
),
SizedBox(
height: 100,
width: 90,
child: FloatingActionButton(
elevation: 0.2,
onPressed: () {
if (_isNum2) {
press_3_button_num2();
} else {
press_3_button_num1();
}
},
child: Text("3"),
),
),
SizedBox(
height: 100,
width: 90,
child: FloatingActionButton(
elevation: 0.2,
onPressed: () {
press_plus_button();
},
child: Text("+"),
),
),
],
),
SizedBox(
height: 20,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
SizedBox(
height: 100,
width: 90,
child: FloatingActionButton(
elevation: 0.2,
onPressed: () {
if (_isNum2) {
press_4_button_num2();
} else {
press_4_button_num1();
}
},
child: Text("4"),
),
),
SizedBox(
height: 100,
width: 90,
child: FloatingActionButton(
elevation: 0.2,
onPressed: () {
if (_isNum2) {
press_5_button_num2();
} else {
press_5_button_num2();
}
},
child: Text("5"),
),
),
SizedBox(
height: 100,
width: 90,
child: FloatingActionButton(
elevation: 0.2,
onPressed: () {
if (_isNum2) {
press_6_button_num2();
} else {
press_6_button_num1();
}
},
child: Text("6"),
),
),
SizedBox(
height: 100,
width: 90,
child: FloatingActionButton(
elevation: 0.2,
onPressed: () {
press_minus_button();
},
child: Text("-"),
),
),
],
),
SizedBox(
height: 20,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
SizedBox(
height: 100,
width: 90,
child: FloatingActionButton(
elevation: 0.2,
onPressed: () {
if (_isNum2) {
press_7_button_num2();
} else {
press_7_button_num1();
}
},
child: Text("7"),
),
),
SizedBox(
height: 100,
width: 90,
child: FloatingActionButton(
elevation: 0.2,
onPressed: () {
if (_isNum2) {
press_8_button_num2();
} else {
press_8_button_num1();
}
},
child: Text("8"),
),
),
SizedBox(
height: 100,
width: 90,
child: FloatingActionButton(
elevation: 0.2,
onPressed: () {
if (_isNum2) {
press_9_button_num2();
} else {
press_9_button_num1();
}
},
child: Text("9"),
),
),
SizedBox(
height: 100,
width: 90,
child: FloatingActionButton(
elevation: 0.2,
onPressed: () {
press_multiple_button();
},
child: Text("*"),
),
),
],
),
SizedBox(
height: 3,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
SizedBox(
height: 90,
width: 90,
child: FloatingActionButton(
elevation: 0.2,
onPressed: () {
if (_isNum2) {
press_0_button_num2();
} else {
press_0_button_num1();
}
},
child: Text("0"),
isExtended: true,
),
),
SizedBox(
height: 75,
width: 180,//290
child: FloatingActionButton.extended(
elevation: 0.2,
onPressed: () {
calculate();
},
label: Text("="),
isExtended: true,
),
),
SizedBox(
height: 100,
width: 90,
child: FloatingActionButton(
elevation: 0.2,
onPressed: () {
press_divided_button();
},
child: Text("/"),
),
)
],
),
SizedBox(height: 47.5),
],
),
),
);
}
}
I have two errors in Xcode:
Go into xcode and change your Bundle Identifier to something like this using your own website name.
com.mywebsitename.calculator

Centering google-slides text

I'm creating google slides from a csv upload via the browser. When I'm inserting text, how would I center that? They only show up on the right side for some reason.
const requests = [
{
createShape: {
objectId: `shape${csv.ID}`,
shapeType: "TEXT_BOX",
elementProperties: {
pageObjectId: `slide${index}`,
size: {
height: height,
width: width
},
transform: {
scaleX: 1,
scaleY: 1,
translateX: 350,
translateY: 100,
unit: "PT"
}
}
}
},
{
insertText: {
objectId: `shape${csv.ID}`,
insertionIndex: 0,
text: csv.text
}
}
];
```
You want to put the value of csv.text to the center of the object of shape${csv.ID} using the method of batchUpdate in Slides API.
If my understanding is correct, how about this modification? In this modification, UpdateParagraphStyleRequest is added to the request body of requests.
Modified script:
const requests = [
{
createShape: {
objectId: `shape${csv.ID}`,
shapeType: "TEXT_BOX",
elementProperties: {
pageObjectId: `slide${index}`,
size: {
height: height,
width: width
},
transform: {
scaleX: 1,
scaleY: 1,
translateX: 350,
translateY: 100,
unit: "PT"
}
}
}
},
{
insertText: {
objectId: `shape${csv.ID}`,
insertionIndex: 0,
text: csv.text
}
},
{
updateParagraphStyle: {
objectId: `shape${csv.ID}`,
textRange: {type: "ALL"},
style: {alignment: "CENTER"},
fields: "alignment"
}
}
];
Reference:
UpdateParagraphStyleRequest

HighStock: Trend jumping out of Chart Area on zooming with zoomType='xy' or zoomType='y'

I am working with HighCharts (Version:^5.0.14) and React(react:^15.0.1, react-dom:^15.0.1).
I am facing an issue with HighStock Chart Zooming. With the zoomType = 'xy' or zoomType='y', the zoomed HighStock trend jumps of the X-Axis and Y-Axis. Below is the picture. However if Zooming type zoomType = 'X' no issues. The problem is faced when including zoomType = 'y'
Below is the Code:
import React from 'react';
import highcharts from 'highcharts/highstock';
export default class Chart extends React.Component {
constructor (props) {
super(props);
this.state = {
chartName: `chart${this.props.chartNum}`
};
}
componentDidMount () {
let chartOptions = {};
chartOptions = {
rangeSelector: {enabled: false },
credits: { enabled: false },
tooltip: {
pointFormat: '<span style="color:{series.color}">{series.name}</span>: <b>{point.y:.2f}</b> <br/>'
},
navigator: {
enabled: false
},
scrollbar: {
enabled: false
},
plotOptions:{
series:{
turboThreshold:5000//set it to a larger threshold, it is by default to 1000,
}
},
xAxis:{
type: 'dateTime',
minRange:3600000,
events:{
setExtremes:function(event){
this.min=event.min;
this.max=event.max;
}
}
},
yAxis: {
offset: 15,
labels: {
align: 'center',
x: -5,
y: 0
},
opposite:false,
showLastLabel: true,
min: this.dataMin,
max: this.dataMax,
events:{
setExtremes:function(events){
console.log("Card::YAxis::setExtremes::events.min and events.max = " + events.min +", "+ events.max);
this.dataMin = events.min;
this.dataMax = events.Max;
this.min = events.min;
this.max = events.max;
}
},
tickPositioner: function () {
var positions;
var Maxdata = this.max;
var MinData = this.min;
if(ticksData != null){
positions = ticksData;
}else{
positions = [];
var tick = Math.floor(this.min);
if(this.min == this.max){
positions.push(this.min);
}else{
if (this.max !== null && this.min !== null) {
Maxdata = Maxdata.toFixed(2);
MinData = MinData.toFixed(2);
tick = parseFloat(MinData);
var increment = (Maxdata - MinData)/5;
increment=increment.toFixed(2);
for (tick; tick-increment<= Maxdata; tick=(parseFloat(increment)+parseFloat(tick)).toFixed(2)) {
if(positions.includes(tick)){
break;
}
else{
positions.push(tick);
}
}
}else{
positions = [0];
}
}
}
return positions;
}
}
};
chartOptions.chart = {
renderTo: document.getElementById(this.state.chartName),
zoomType: 'xy',
spacingBottom: 35,
resetZoomButton: {
position: {
align: 'right', // by default
verticalAlign: 'bottom', // by default
x: 8,
y: 20
}
},
events:{
redraw: function(){
var serie1 = this.series[0],
yExtremes = this.yAxis[0].getExtremes();
var yMin = yExtremes.min;
var yMax = yExtremes.max;
var dataSet = serie1.data;
var zoomedDataSet= [];
var dataGroup;
if(dataSet != undefined && dataSet != null){
for(var i=0; i<dataSet.length; i++)
{
if(dataSet[i] != undefined){
dataGroup = dataSet[i];
if(dataGroup[1] > yMin && dataGroup[1]< yMax){
zoomedDataSet.push(dataGroup);
}
}
}
serie1.data = zoomedDataSet;
}
}
}
};
// Generate chart.
this.generateChart(this.props.data, chartOptions);
}
componentWillUpdate (nextProps) {
let chartOptions = {};
chartOptions = {
rangeSelector: {enabled: false },
credits: { enabled: false },
tooltip: {
pointFormat: '<span style="color:{series.color}">{series.name}</span>: <b>{point.y:.2f}</b> <br/>'
},
navigator: {
enabled: false
},
scrollbar: {
enabled: false
},
plotOptions:{
series:{
turboThreshold:5000//set it to a larger threshold, it is by default to 1000,
}
},
xAxis:{
type: 'dateTime',
minRange:3600000,
events:{
setExtremes:function(event){
this.min=event.min;
this.max=event.max;
}
}
},
yAxis: {
offset: 15,
labels: {
align: 'center',
x: -5,
y: 0
},
opposite:false,
showLastLabel: true,
min: this.dataMin,
max: this.dataMax,
events:{
setExtremes:function(events){
console.log("Card::YAxis::setExtremes::events.min and events.max = " + events.min +", "+ events.max);
this.dataMin = events.min;
this.dataMax = events.Max;
this.min = events.min;
this.max = events.max;
}
},
tickPositioner: function () {
var positions;
var Maxdata = this.max;
var MinData = this.min;
if(ticksData != null){
positions = ticksData;
}else{
positions = [];
var tick = Math.floor(this.min);
if(this.min == this.max){
positions.push(this.min);
}else{
if (this.max !== null && this.min !== null) {
Maxdata = Maxdata.toFixed(2);
MinData = MinData.toFixed(2);
tick = parseFloat(MinData);
var increment = (Maxdata - MinData)/5;
increment=increment.toFixed(2);
for (tick; tick-increment<= Maxdata; tick=(parseFloat(increment)+parseFloat(tick)).toFixed(2)) {
if(positions.includes(tick)){
break;
}
else{
positions.push(tick);
}
}
}else{
positions = [0];
}
}
}
return positions;
}
}
};
chartOptions.chart = {
renderTo: document.getElementById(this.state.chartName),
zoomType: 'xy',
spacingBottom:35,
resetZoomButton: {
position: {
align: 'right', // by default
verticalAlign: 'bottom', // by default
x: 8,
y: 20
}
},
events:{
redraw: function(){
var serie1 = this.series[0],
yExtremes = this.yAxis[0].getExtremes(),
var yMin = yExtremes.min;
var yMax = yExtremes.max;
var dataSet = serie1.data;
var zoomedDataSet= [];
if(dataSet != undefined && dataSet != null ){
for(var i=0; i<dataSet.length; i++)
{
if(dataSet[i] != undefined){
dataGroup = dataSet[i];
if(dataGroup[1] >= yMin && dataGroup[1]<=yMax && dataGroup[0] >= xMin && dataGroup[0]<= xMax){
zoomedDataSet.push(dataGroup);
}
}
}
serie1.data = zoomedDataSet;
}
}
}
};
this.generateChart(nextProps.data, chartOptions);
}
generateChart (data, chartOptions) {
chartOptions.series = [
{
name: this.props.title,
type: this.props.status ? 'area' : 'line',
data: data,
clip: false
}
];
let chart = new highcharts.StockChart(chartOptions);
}
render () {
const selfStyle = {
height: '200px'
};
return (
<div
className="med-chart col-md-9"
id={this.state.chartName}
style={selfStyle}>
</div>
);
}
}
I have setExtremes set with event Min and Max values for Y-Axis, but it does not help. If any of you have faced a similar issue, request to share your approach to resolve this problem. Greatly appreciate your time in reading the post and your valuable inputs in advance.

HightCharts Realtime line error

HightCharts realtime line error
Who had the following problems?
var loadChart = function () {
$.getJSON('data.json', function (json) {
var index = 0;
var getData = function (index, type) {
var result = null;
if (type != undefined) {
result = parseInt(json[index][type]);
} else {
result = json[index];
}
return result;
};
var getSeriesData = function () {
// 结构
var JJData = [],
PCData = [],
PhoneData = [],
item;
var time = (new Date()).getTime();
for (var i = -179; i <= 0; ++i) {
item = json[index++];
JJData.push({
x: time + i * 2000,
y: parseInt(item.JJ)
});
PCData.push({
x: time + i * 2000,
y: parseInt(item.PC)
});
PhoneData.push({
x: time + i * 2000,
y: parseInt(item.Phone)
});
}
var result = [{
name: "JJ",
data: JJData
}, {
name: "PC",
data: PCData
}, {
name: "Phone",
data: PhoneData
}];
return result;
};
chart = new Highcharts.Chart({
chart: {
renderTo: 'container1',
type: 'spline', //spline
backgroundColor: 'rgba(202, 202, 202, 0.2)',
animation: Highcharts.svg, // don't animate in old IE
//marginRight: 10,
events: {
load: function () {
var series = this.series;
loadMinuteData = function () {
if (!minuteFlag) {
clearInterval(setMinuteInter);
return false;
}
var x = (new Date()).getTime(); // current time
var result = getData(index++);
// 第三个参数为true,移除最开始的数据
//console.log("minute");
//console.log(series[0]);
//alert(series[0]);
series[0].addPoint([x, parseInt(result.JJ)], true, true);
series[1].addPoint([x, parseInt(result.PC)], true, true);
series[2].addPoint([x, parseInt(result.Phone)], true, true);
};
var setMinuteInter = setInterval(loadMinuteData, 2000);
}
}
},
title: {
text: '实时在线人数'
},
xAxis: [{
type: 'datetime',
tickPixelInterval: 60
}],
yAxis: {
title: {
text: '人数'
},
plotLines: [{
value: 0,
width: 1,
color: '#808080'
}]
},
plotOptions: {
spline: {
marker: {
enabled: false
}
}
},
tooltip: {
formatter: function () {
return '<b>' + this.series.name + '</b><br/>' +
Highcharts.dateFormat('%Y-%m-%d %H:%M:%S', this.x) + '<br/>' +
Highcharts.numberFormat(this.y, 2);
}
},
legend: {
enabled: true
},
exporting: {
enabled: false
},
series: getSeriesData()
});
});
}

Highcharts setExtremes overflow issue

I have a Highcharts column graph with 10 series on the x axis.
http://qaa.balcroft.com/images/chart1.png
I want to allow the user to zoom in so I added a button to setExtremes:
$('#zoomInButton').click(function () {
var chart = $('#container').highcharts();
chart.xAxis[0].setExtremes(4, 9);
});
However this causes the graph to overflow into the y axis title area on the left hand side.
http://qaa.balcroft.com/images/chart2.png
I've tried amending xAxis.minRange and yAxis.overflow but neither fixes the problem.
Any suggestions?
The function to create the graph is
function inialiseGraphOnLoad(strOrgCode, strLevelCode, currentLevel, strTeamName){
var jsonMimeType = "application/json;charset=UTF-8";
$.ajax({
type: "POST",
url: "ajax/getStaffOnLoad.php",
cache: false,
data: {org: strOrgCode, levelcode: strLevelCode, level: currentLevel},
beforeSend: function(x) {
if(x && x.overrideMimeType) {
x.overrideMimeType(jsonMimeType);
}
},
dataType: 'json',
success: function(dataDepts){
//Create array of employee names
chartWidth = 0;
maxZoom = 0;
var listDepts = [];
for (var i = 0; i < dataDepts.employees.length; i++) {
chartWidth = chartWidth + 250;
maxZoom = maxZoom + 1;
var arrayEmployee = dataDepts.employees[i].name;
var splitResult = arrayEmployee.split("||");
var strEmployeeCode=splitResult[0];
var strEmployeeName=splitResult[1];
var employeeURL = serverURL + strEmployeeCode + '">' + strEmployeeName + '</a>';
listDepts.push(employeeURL);
}
var mainPageWidth = $('#staffMainPage').width();
if(chartWidth > mainPageWidth){
chartWidth = mainPageWidth;
}else if(chartWidth < 500){
chartWidth = 500;
}
$('#hid_lastPage').val(maxZoom);
//Create series array
var seriesArray = [];
for (var i = 0; i < dataDepts.groups.length; i++) {
seriesArray.push({
name : dataDepts.groups[i].name,
dataLabels: {
enabled: true,
rotation: -90,
color: '#424242',
align: 'right',
x: 4,
y: 10,
style: {
fontFamily: 'Verdana, sans-serif'
},
formatter:function(){
if(this.y > 0){
return this.y;
}
}
},
color : dataDepts.groups[i].colour,
data : []
});
for (var j = 0; j < dataDepts.employees.length; j++) {
if(i == 0){
seriesArray[i].data.push(dataDepts.employees[j].rating1);
}else if(i == 1){
seriesArray[i].data.push(dataDepts.employees[j].rating2);
}else if(i == 2){
seriesArray[i].data.push(dataDepts.employees[j].rating3);
}else if(i == 3){
seriesArray[i].data.push(dataDepts.employees[j].rating4);
}else if(i == 4){
seriesArray[i].data.push(dataDepts.employees[j].rating5);
}else if(i == 5){
seriesArray[i].data.push(dataDepts.employees[j].rating6);
}else if(i == 6){
seriesArray[i].data.push(dataDepts.employees[j].rating7);
}else if(i == 7){
seriesArray[i].data.push(dataDepts.employees[j].rating8);
}else if(i == 8){
seriesArray[i].data.push(dataDepts.employees[j].rating9);
}else if(i == 9){
seriesArray[i].data.push(dataDepts.employees[j].rating10);
}else if(i == 10){
seriesArray[i].data.push(dataDepts.employees[j].rating11);
}else if(i == 11){
seriesArray[i].data.push(dataDepts.employees[j].rating12);
}else if(i == 12){
seriesArray[i].data.push(dataDepts.employees[j].rating13);
}else if(i == 13){
seriesArray[i].data.push(dataDepts.employees[j].rating14);
}else if(i == 14){
seriesArray[i].data.push(dataDepts.employees[j].rating15);
}
}
}
// Set up the chart
var chart = new Highcharts.Chart({
chart: {
renderTo: 'container',
type: 'column',
width: chartWidth,
height: 550,
marginBottom: 100,
margin: 80,
options3d: {
enabled: true,
alpha: 5,
beta: 10,
depth: 50,
viewDistance: 25
}
},
title: {
text: strTeamName
},
subtitle: {
text: 'Quality Rating By Employee'
},
xAxis: {
categories: listDepts,
useHTML: true,
minRange: 5,
title: {
text: '<br>(click an employee name for more detail)',
style: {
color: '#6E6E6E',
fontSize: '1em',
fontFamily: 'Verdana, sans-serif'
}
}
},
yAxis: {
min: 0,
title: {
text: 'Quality Rating (%)',
align: 'high'
},
labels: {
overflow: 'justify'
}
},
tooltip: {
valueSuffix: ' %'
},
scrollbar: {
enabled: true
},
plotOptions: {
column: {
depth: 25
},
bar: {
dataLabels: {
enabled: true
}
}
},
series:seriesArray
});
}
});
}

Resources