I keep getting this error code on different lines every time I run this script , but I can not figure out why? here is the source code. I will answer any questions and or can respond quickly . I'm not sure what other details to give.
$(function() {
var
bungieId = checkParams('bungieId'),
destinyId = checkParams('destinyId'),
joined = checkParams('joined'),
checkName = function(name, list) {
var m = false; // flag
console.log('Checking list for ' + name + '...');
// loop through clan usernames and check for a match
$.each(list, function(i) {
// make case insensitve
if (name.toLowerCase() === list[i].toLowerCase()) {
console.log('Confirmed: ' + list[i]);
m = true;
}
});
if (m) {
return true;
} else {
return false;
}
};
if (bungieId && destinyId && joined) {
$.ajax({
url: "https://www.bungie.net/Platform/Destiny2/2/Account/" + destinyId + "/Character/0/Stats/UniqueWeapons/",
headers: {
"X-API-Key": apiKey
},
success: function(data) {
if (data.ErrorStatus === 'Success') {
Telesto = data.Response.weapons[0].values.uniqueWeaponKills.basic.displayValue,
TheHuckleberry = data.Response.weapons[1].values.uniqueWeaponKills.basic.displayValue,
RatKing = data.Response.weapons[2].values.uniqueWeaponKills.basic.displayValue,
Anarchy = data.Response.weapons[3].values.uniqueWeaponKills.basic.displayValue,
SUROSRegime = data.Response.weapons[4].values.uniqueWeaponKills.basic.displayValue,
Sunshot = data.Response.weapons[5].values.uniqueWeaponKills.basic.displayValue,
DARCI = data.Response.weapons[6].values.uniqueWeaponKills.basic.displayValue,
Borealis = data.Response.weapons[7].values.uniqueWeaponKills.basic.displayValue,
Thunderlord = data.Response.weapons[8].values.uniqueWeaponKills.basic.displayValue,
PolarisLance = data.Response.weapons[9].values.uniqueWeaponKills.basic.displayValue,
Crimson = data.Response.weapons[10].values.uniqueWeaponKills.basic.displayValue,
FightingLion = data.Response.weapons[11].values.uniqueWeaponKills.basic.displayValue,
TractorCannon = data.Response.weapons[12].values.uniqueWeaponKills.basic.displayValue,
LeMonarque = data.Response.weapons[13].values.uniqueWeaponKills.basic.displayValue,
GravitonLance = data.Response.weapons[14].values.uniqueWeaponKills.basic.displayValue,
VigilanceWing = data.Response.weapons[15].values.uniqueWeaponKills.basic.displayValue,
BlackTalon = data.Response.weapons[16].values.uniqueWeaponKills.basic.displayValue,
TheColony = data.Response.weapons[17].values.uniqueWeaponKills.basic.displayValue,
SleeperSimulant = data.Response.weapons[18].values.uniqueWeaponKills.basic.displayValue,
HardLight = data.Response.weapons[19].values.uniqueWeaponKills.basic.displayValue,
Merciless = data.Response.weapons[20].values.uniqueWeaponKills.basic.displayValue,
SkyburnersOath = data.Response.weapons[21].values.uniqueWeaponKills.basic.displayValue,
PrometheusLens = data.Response.weapons[22].values.uniqueWeaponKills.basic.displayValue,
Malfeasance = data.Response.weapons[23].values.uniqueWeaponKills.basic.displayValue,
OutbreakPerfected = data.Response.weapons[24].values.uniqueWeaponKills.basic.displayValue,
Jötunn = data.Response.weapons[25].values.uniqueWeaponKills.basic.displayValue,
WishEnder = data.Response.weapons[26].values.uniqueWeaponKills.basic.displayValue,
SweetBusiness = data.Response.weapons[27].values.uniqueWeaponKills.basic.displayValue,
Coldheart = data.Response.weapons[28].values.uniqueWeaponKills.basic.displayValue,
TheWardcliffCoil = data.Response.weapons[29].values.uniqueWeaponKills.basic.displayValue,
LegendofAcrius = data.Response.weapons[30].values.uniqueWeaponKills.basic.displayValue,
Wavesplitter = data.Response.weapons[31].values.uniqueWeaponKills.basic.displayValue,
WhisperoftheWorm = data.Response.weapons[32].values.uniqueWeaponKills.basic.displayValue,
Arbalest = data.Response.weapons[33].values.uniqueWeaponKills.basic.displayValue,
TwoTailedFox = data.Response.weapons[34].values.uniqueWeaponKills.basic.displayValue,
Sturm = data.Response.weapons[35].values.uniqueWeaponKills.basic.displayValue,
Riskrunner = data.Response.weapons[36].values.uniqueWeaponKills.basic.displayValue,
IzanagisBurden = data.Response.weapons[37].values.uniqueWeaponKills.basic.displayValue,
TheChaperone = data.Response.weapons[38].values.uniqueWeaponKills.basic.displayValue,
LordofWolves = data.Response.weapons[39].values.uniqueWeaponKills.basic.displayValue,
TheProspector = data.Response.weapons[40].values.uniqueWeaponKills.basic.displayValue,
Thorn = data.Response.weapons[41].values.uniqueWeaponKills.basic.displayValue,
TheLastWord = data.Response.weapons[42].values.uniqueWeaponKills.basic.displayValue,
Cerberus = data.Response.weapons[43].values.uniqueWeaponKills.basic.displayValue,
WorldlineZero = data.Response.weapons[44].values.uniqueWeaponKills.basic.displayValue,
TheQueenbreaker = data.Response.weapons[45].values.uniqueWeaponKills.basic.displayValue,
BadJuju = data.Response.weapons[46].values.uniqueWeaponKills.basic.displayValue,
Lumina = data.Response.weapons[47].values.uniqueWeaponKills.basic.displayValue,
LegendofAcrius = data.Response.weapons[48].values.uniqueWeaponKills.basic.displayValue,
TheJadeRabbit = data.Response.weapons[49].values.uniqueWeaponKills.basic.displayValue,
AceofSpades = data.Response.weapons[50].values.uniqueWeaponKills.basic.displayValue,
TrinityGhoul = data.Response.weapons[51].values.uniqueWeaponKills.basic.displayValue,
Truth = data.Response.weapons[52].values.uniqueWeaponKills.basic.displayValue,
MIDAMultiTool = data.Response.weapons[53].values.uniqueWeaponKills.basic.displayValue;
$('#player-AceofSpades').text(AceofSpades);
$('#player-TheJadeRabbit').text(TheJadeRabbit);
$('#player-TrinityGhoul').text(TrinityGhoul);
$('#player-SweetBusiness').text(SweetBusiness);
$('#player-TheWardcliffCoil').text(TheWardcliffCoil);
$('#player-Wavesplitter').text(Wavesplitter);
$('#player-TheQueenbreaker').text(TheQueenbreaker);
$('#player-PrometheusLens').text(PrometheusLens);
$('#player-Two-TailedFox').text(Two - TailedFox);
$('#player-TheJadeRabbit').text(TheJadeRabbit);
$('#player-DARCI').text(DARCI);
$('#player-TheChaperone').text(TheChaperone);
$('#player-Lumina').text(Lumina);
$('#player-LegendofAcrius').text(LegendofAcrius);
$('#player-GravitonLance').text(GravitonLance);
$('#player-SleeperSimulant').text(SleeperSimulant);
$('#player-SkyburnersOath').text(SkyburnersOath);
$('#player-Merciless').text(Merciless);
$('#player-Thorn').text(Thorn);
$('#player-LeMonarque').text(LeMonarque);
$('#player-BlackTalon').text(BlackTalon);
$('#player-TheProspector').text(TheProspector);
$('#player-Crimson').text(Crimson);
$('#player-Borealis').text(Borealis);
$('#player-PolarisLance').text(PolarisLance);
$('#player-IzanagisBurden').text(IzanagisBurden);
$('#player-Sunshot').text(Sunshot);
$('#player-Arbalest').text(Arbalest);
$('#player-WhisperoftheWorm').text(WhisperoftheWorm);
$('#player-LegendofAcrius').text(LegendofAcrius);
$('#player-TheLastWord').text(TheLastWord);
$('#player-MIDAMulti-Tool').text(MIDAMulti - Tool);
$('#player-Wish-Ender').text(Wish - Ender);
$('#player-Jötunn').text(Jötunn);
$('#player-Malfeasance').text(Malfeasance);
$('#player-PrometheusLens').text(PrometheusLens);
$('#player-OutbreakPerfected').text(OutbreakPerfected);
$('#player-Truth').text(Truth);
$('#player-Coldheart').text(Coldheart);
$('#player-Cerberus+').text(Cerberus);
$('#player-WorldlineZero').text(WorldlineZero);
$('#player-BadJuju').text(BadJuju);
$('#player-Riskrunner').text(Riskrunner);
$('#player-Thunderlord').text(Thunderlord);
$('#player-Sturm').text(Sturm);
$('#player-LordofWolves').text(LordofWolves);
$('#player-FightingLion').text(FightingLion);
$('#player-TractorCannon').text(TractorCannon);
$('#player-VigilanceWing').text(VigilanceWing);
} else {
alert('Uh oh, failed to load player stats! Looks like Bungie\'s doing server maintenance or having problems. Please check back again soon!');
console.log(data);
}
},
error: function(data) {
alert('Uh oh, failed to load player stats! Looks like Bungie\'s doing server maintenance or having problems. Please check back again soon!');
console.log('Error loading player stats:', data);
}
});
}
});
This is the error code :
"Response": {
"weapons": [{
"referenceId": 2208405142,
"values": {
"uniqueWeaponAssists": {
"statId": "uniqueWeaponAssists",
"basic": {
"value": 0.0,
"displayValue": "0"
}
},
"uniqueWeaponAssistDamage": {
"statId": "uniqueWeaponAssistDamage",
"basic": {
"value": 0.0,
"displayValue": "0"
}
},
"uniqueWeaponKills": {
"statId": "uniqueWeaponKills",
"basic": {
"value": 2069.0,
"displayValue": "2069"
}
},
"uniqueWeaponPrecisionKills": {
"statId": "uniqueWeaponPrecisionKills",
"basic": {
"value": 0.0,
"displayValue": "0"
}
},
"uniqueWeaponKillsPrecisionKills": {
"statId": "uniqueWeaponKillsPrecisionKills",
"basic": {
"value": 0.0,
"displayValue": "0%"
}
}
}
},
{
"referenceId": 2286143274,
"values": {
"uniqueWeaponAssists": {
"statId": "uniqueWeaponAssists",
"basic": {
"value": 0.0,
"displayValue": "0"
}
},
"uniqueWeaponAssistDamage": {
"statId": "uniqueWeaponAssistDamage",
"basic": {
"value": 0.0,
"displayValue": "0"
}
},
"uniqueWeaponKills": {
"statId": "uniqueWeaponKills",
"basic": {
"value": 1529.0,
"displayValue": "1529"
}
},
"uniqueWeaponPrecisionKills": {
"statId": "uniqueWeaponPrecisionKills",
"basic": {
"value": 532.0,
"displayValue": "532"
}
},
"uniqueWeaponKillsPrecisionKills": {
"statId": "uniqueWeaponKillsPrecisionKills",
"basic": {
"value": 0.34793982995421846,
"displayValue": "35%"
}
}
}
},
{
"referenceId": 2362471601,
"values": {
"uniqueWeaponAssists": {
"statId": "uniqueWeaponAssists",
"basic": {
"value": 0.0,
"displayValue": "0"
}
},
"uniqueWeaponAssistDamage": {
"statId": "uniqueWeaponAssistDamage",
"basic": {
"value": 0.0,
"displayValue": "0"
}
},
"uniqueWeaponKills": {
"statId": "uniqueWeaponKills",
"basic": {
"value": 169.0,
"displayValue": "169"
}
},
"uniqueWeaponPrecisionKills": {
"statId": "uniqueWeaponPrecisionKills",
"basic": {
"value": 57.0,
"displayValue": "57"
}
},
"uniqueWeaponKillsPrecisionKills": {
"statId": "uniqueWeaponKillsPrecisionKills",
"basic": {
"value": 0.33727810650887574,
"displayValue": "34%"
}
}
}
},
This is a Sample of the Json response Im simply trying to make the https request, and then parse it into dot notation in a java script file, and then call the objects in html.
I would say you are ether trying to access values before its been created because of asynchronous ajax or you are just not accessing the JSON correctly. I would recommend opening the chrome debugger and putting some break points in to follow the data.
Related
I am trying to get my hands on javascript and elasticsearch and I was trying to create queries using the elastic-builder javascript lib.
I might be missing something which I am trying to figure out but unfortunately I am unable to.
Problem: I am trying to create multilevel aggregation like below,
"aggs": {
"1": {
"date_histogram": {
"field": "f1",
"calendar_interval": "1D"
},
"aggs": {
"2": {
"date_histogram": {
"field": "f2",
"calendar_interval": "1D"
},
"aggs": {
"3": {
"date_histogram": {
"field": "f3",
"calendar_interval": "1D"
}
}
}
}
}
}
But what I get instead is this:
"aggs": {
"1": {
"date_histogram": {
"field": "f1",
"calendar_interval": "1D"
},
"aggs": {
"2": {
"date_histogram": {
"field": "f2",
"calendar_interval": "1D"
}
},
"3": {
"date_histogram": {
"field": "f3",
"calendar_interval": "1D"
}
}
}
}
The current output I get has two aggregations nested in one. I am trying to build it using an array with aggregations defined in it.
The code I used is below:
let a = [
esb.dateHistogramAggregation('1', "d[key]['field']").calendarInterval('1D'),
esb.dateHistogramAggregation('2', "d[key]['field']").calendarInterval("1D"),
esb.dateHistogramAggregation('3', "d[key]['field']").calendarInterval("1D")
];
let m = null;
for(i=0;i<a.length;i++) {
if(i === 0) {
m = a[i]
} else {
m.agg(a[i])
}
}
//m = esb.dateHistogramAggregation('1', "d[key]['field']").calendarInterval('1D')
//m = m.agg(esb.dateHistogramAggregation('2', "d[key]['field']").calendarInterval("1D").agg(esb.dateHistogramAggregation('3', "d[key]['field']").calendarInterval("1D")))
esb.requestBodySearch()
.query(
esb.boolQuery()
.must(esb.matchQuery('message', 'this is a test'))
.filter(esb.termQuery('user', 'kimchy'))
.filter(esb.termQuery('user', 'herald'))
.should(esb.termQuery('user', 'johnny'))
.mustNot(esb.termQuery('user', 'cassie'))
)
.agg(esb.termsAggregation('user_terms', 'user').agg(esb.termsAggregation('user_terms', 'user').agg(esb.termsAggregation('user_terms', 'user'))))
.agg(m);
The lines commented in the code will output the result I'm expecting. What am I doing wrong?
You can turn the array into a group of sub-aggregations like so:
let a = [
esb.dateHistogramAggregation('1', "d[key]['field']").calendarInterval('1D'),
esb.dateHistogramAggregation('2', "d[key]['field']").calendarInterval("1D"),
esb.dateHistogramAggregation('3', "d[key]['field']").calendarInterval("1D")
];
const reqBody = esb.requestBodySearch()
.agg(
a[0].agg(
a[1].agg(
a[2]
)
)
);
I solved it like below. I am not sure this is right way. But someone can correct me if I am wrong.
let temp = null;
for (i = a.length - 1; i >= 0; i--) {
if (i === a.length - 1) {
temp = a[i];
} else {
temp = a[i].agg(temp)
}
}
I have a search input in my angular application that should compare the input data with different object properties
<div class="forms">
<div class="search-wrapper">
<input
class="search"
[ngClass]="{'searching': searching}"
type="text"
(input)="changeSearch($event.target.value)"
/>
<label class="">
<span>Rechercher</span>
</label>
</div>
</div>
the logic I use is as follows
public changeSearch(searchTerm: string) {
this.searching = !!searchTerm;
if (!this.searching) {
this.orders.forEach(order => {
order.show = true;
});
return;
}
const extendSearchIn = ['order_number', 'transaction.item.product.name'];
this.orders.forEach(order => {
order.show = true;
extendSearchIn.forEach(property => {
this.searchByProperty(order, property, searchTerm);
});
});
}
public searchByProperty(order, property, searchTerm) {
const prop = this.getSearchProperty(order, property);
if (prop === undefined) { return false; }
return (<String>prop.toLowerCase()).startsWith(searchTerm.toLowerCase());
}
public getSearchProperty(item: object, property: string) {
let itemCopy = Object.assign({}, item);
let result: any;
const props = property.split('.');
props.forEach(prop => {
if (itemCopy !== undefined) {
itemCopy = itemCopy[prop];
}
});
result = itemCopy !== undefined ? itemCopy : result;
return result;
}
and the structure of each object 'order' is like the following
{
"functional_id": "202006101058160012400000SD4AYAA1",
"transactions": [
{
"quantity": 2,
"price": 140,
"item": {
"name": "Carton",
"description": "+ 2 recharges",
"product": {
"name": "Coffret rouge"
}
},
"amount": 280
},
{
"quantity": 2,
"price": 140,
"item": {
"name": "10 coffrets",
"description": "+ 2 recharges",
"product": {
"name": "Coffret gris"
}
},
"amount": 280
},
{
"quantity": 2,
"price": 60,
"item": {
"name": "PACK N°1 comprenant :",
"description": "6 modèles",
"product": {
"name": "AfuBOX",
"description": "60,8 x 39,5 x 16,5 cm"
}
},
"amount": 120
}
],
"show": true,
"date": "10/06/2020",
"order_number": "105816",
"overallAmount": 680
}
you would need to set the 'show' property to false so that those that don't comply with what was entered in the search field would be hidden
Someone to make me see where my mistake is.
Thank you in advance
I have simplified the logic with a forEach and checking if the value I receive from the input contains any of the search criteria I wanted to apply.
I hope that this will help you to explain if you find yourself in a similar situation.
public changeSearch(searchTerm: string) {
this.searching = !!searchTerm;
if (!this.searching) {
this.orders.forEach(order => {
order.show = true;
});
return;
}
this.orders.forEach(order => {
order.show = true;
this.searchByProperty(order, searchTerm);
});
}
public searchByProperty(order, searchTerm) {
const id = (order.order_number + '');
const amount = (order.overallAmount + '');
order.transactions.forEach(items => {
const title = items.item.product.name.toLowerCase();
if (title.includes(searchTerm) || id.includes(searchTerm) || amount.includes(searchTerm)) {
order.show = true;
} else {
order.show = false;
}
});
}
I am trying to get a bubble chart to populate using ngx-charts. The problem is the swimlane documentation on it is almost non-existent and I haven't been able to find any good examples.
I have read the open source code that swimlane provides and have created what I believe are the appropriate variables in Typescript and have constructed my data points using an example line graph I found using the same tools. However the chart still appears empty on the page.
HTML:
<ngx-charts-bubble-chart
[view]="view"
[results]="bubbleDemoTempData"
[showGridLines]="showGridLines"
[legend]="showLegend"
[legendTitle]="legendTitle"
[xAxis]="showXAxis"
[yAxis]="showYAxis"
[showXAxisLabel]="showXAxisLabel"
[showYAxisLabel]="showYAxisLabel"
[xAxisLabel]="xAxisLabel"
[yAxisLabel]="yAxisLabel"
[autoScale]="autoScale"
[scheme]="colorScheme"
[minRadius]="minRadius"
[maxRadius]="maxRadius"
(select)="onSelectBubbleInteractivePoint($event)"
*ngIf="dataTypeDisplay == 'GraphForm'"
[#fade]>
</ngx-charts-bubble-chart>
TypeScript:
view: any[] = [700, 400];
// options
showXAxis = true;
showXAxisLabel = true;
showYAxisLabel = true;
showYAxis = true;
gradient = false;
showLegend = true;
legendTitle = "Hi";
xAxisLabel = 'Number';
yAxisLabel = 'Color Value';
showGridLines = true;
autoScale=true;
minRadius = 1;
maxRadius = 1;
colorScheme = {
domain: ['#5AA454', '#A10A28', '#C7B42C', '#AAAAAA']
};
Data Points:
public multi = [
{
"name": "Germany",
"series": [
{
"name": "2010",
"value": 7300000
},
{
"name": "2011",
"value": 8940000
}
]
},
{
"name": "USA",
"series": [
{
"name": "2010",
"value": 7870000
},
{
"name": "2011",
"value": 8270000
}
]
},
{
"name": "France",
"series": [
{
"name": "2010",
"value": 5000002
},
{
"name": "2011",
"value": 5800000
}
]
}
];
I would appreciate if someone could give me some advice on correctly populating the chart.
I was eventually able to get it worked out. I will post the same 3 code snippets from above here in their updated forms.
HTML:
<ngx-charts-bubble-chart
[results]="bubbleDemoTempData"
[view]="view"
[showGridLines]="showGridLines"
[legend]="legend"
[legendTitle]="legendTitle"
[legendPosition]="legendPOsition"
[xAxis]="XAxis"
[yAxis]="YAxis"
[showXAxisLabel]="showXAxisLabel"
[showYAxisLabel]="showYAxisLabel"
[xAxisLabel]="xAxisLabel"
[yAxisLabel]="yAxisLabel"
[trimXAxisTicks]="trimXAxisTicks"
[trimYAxisTicks]="trimYAxisTicks"
[maxXAxisTickLength]="maxXAxisTickLength"
[maxYAxisTickLength]="maxYAxisTickLength"
[roundDomains]="roundDomains"
[minRadius]="minRadius"
[maxRadius]="maxRadius"
[autoScale]="autoScale"
[schemeType]="schemeType"
(select)="onSelectBubbleInteractivePoint($event)"
*ngIf="dataTypeDisplay == 'GraphForm'"
[#fade]>
</ngx-charts-bubble-chart>
TypeScript:
view: any[] = [700, 400];
// options
showGridLines = true;
legend = true;
legendTitle = "Dots Mf'er";
legendPosition = "right";
xAxis = true;
yAxis = true;
showXAxisLabel = true;
showYAxisLabel = true;
xAxisLabel = "LR";
yAxisLabel = "Jobs";
trimXAxisTicks = true;
trimYAxisTicks = true;
rotateXAxisTicks = true;
maxXAxisTickLength = 16;
maxYAxisTickLength = 16;
// xAxisTicks;
// yAxisTicks;
roundDomains = false;
maxRadius = 5;
minRadius = 5;
autoScale = true;
schemeType = "ordinal";
tooltipDisabled = false;
Data Points:
public bubbleDemoTempData = [
{
"name": "Example1",
"series": [
{
"name": "a",
"x": 0,
"y": 0,
"r": 1
},
{
"name": "b",
"x":10,
"y":3,
"r":10
}
]
},
{
"name":"Example2",
"series": [
{
"name":"1",
"x":20,
"y":1,
"r":30
},
{
"name":"2",
"x":3,
"y":3,
"r":500
}
]
}
];
This works and definitely answers my question from above. That being said the grid lines are still not appearing but that's an entirely different issue that I may have to post a new ticket for.
I am trying to write an if statement that determines whether the getDept JSON array contains more than one value. If it does, then redirect to a different page. Through my research, it seems like it is as simple as getDept.length > 1, I have not been able to make this work though.
My Javascript code is as follows:
$.getJSON("https://apex.oracle.com/pls/apex/mfajertest1/department/"+$x('P2_DEPT_NO').value, function(getDept)
{
console.log(getDept);
if(getDept.length == 0)
{
window.alert("No Department with that ID");
}
else if(getDept.length > 1)
{
apex.navigation.redirect('f?p=71293:11');
}
else
{
$x('P2_DEPT_NAME').readOnly = false;
$x('P2_DEPT_NAME').value=getDept.items[0].dname;
$x('P2_DEPT_NAME').readOnly = true;
$x('P2_DEPT_LOC').readOnly = false;
$x('P2_DEPT_LOC').value=getDept.items[0].loc;
$x('P2_DEPT_LOC').readOnly = true;
$x('P2_DEPT_NO').readOnly = true;
}
});
The getDept JSON array contains this information:
{
"next": {
"$ref": "https://apex.oracle.com/pls/apex/mfajertest1/department/%7Bid%7D?page=1"
},
"items": [
{
"deptno": 10,
"dname": "accounting",
"loc": "madison"
},
{
"deptno": 20,
"dname": "Finance",
"loc": "Milwaukee"
},
{
"deptno": 30,
"dname": "IT",
"loc": "La Crosse"
},
{
"deptno": 40,
"dname": "Purchasing",
"loc": "Green Bay"
},
{
"deptno": 10,
"dname": "Accounting II",
"loc": "Madison II"
},
{
"deptno": 50,
"dname": "Sports",
"loc": "Waukasha"
}
]
}
I would be glad to provide more information regarding this issue if need be.
Your JSON response is actually an object, not an array. The array you're checking for is a property inside that object called items. Thus, wherever you are using getDept, you should instead be using getDept.items:
$.getJSON("https://apex.oracle.com/pls/apex/mfajertest1/department/"+$x('P2_DEPT_NO').value, function(getDept)
{
console.log(getDept.items);
if(getDept.items.length == 0)
{
window.alert("No Department with that ID");
}
else if(getDept.items.length > 1)
{
apex.navigation.redirect('f?p=71293:11');
}
else
{
$x('P2_DEPT_NAME').readOnly = false;
$x('P2_DEPT_NAME').value=getDept.items[0].dname;
$x('P2_DEPT_NAME').readOnly = true;
$x('P2_DEPT_LOC').readOnly = false;
$x('P2_DEPT_LOC').value=getDept.items[0].loc;
$x('P2_DEPT_LOC').readOnly = true;
$x('P2_DEPT_NO').readOnly = true;
}
});
here is my jquery tooltip code.
var $tooltip = $("<div class='tooltip top in'><div class='tooltip-inner'></div></div>").hide().appendTo('body');
var previousPoint = null;
placeholder.on('plothover', function (event, pos, item) {
if (item) {
if (previousPoint != item.seriesIndex) {
previousPoint = item.seriesIndex;
var tip = item.series['label']+":" +item.series['percent'] + '%';
//var tip = item.series['Alert1']+":"+item.series['percent']+'%';
$tooltip.show().children(0).text(tip);
}
$tooltip.css({ top: pos.pageY + 10, left: pos.pageX + 10 });
} else {
$tooltip.hide();
previousPoint = null;
}
});
And my Json Data :
[
{
"label": "FDR Compliance",
"Assessments": "151",
"Conductedon": "101",
"OpenTasks": "141",
"charts": [
{
"label":"Low",
"data": "60",
"Alert1":"90 Day",
"Alert2":"Key Member",
"color":"#68BC31"
},
{
"label":"High",
"data": "30",
"Alert1":"Missed",
"Alert2":"YTD",
"color": "#DA5430"
},
{
"label":"Medium",
"data": "15",
"Alert1":"E & OE",
"Alert2":"Failure",
"color": "#FEE074"
}
]
}
]
In the above code if in jQuery the tool will display the data if it is:
var tip = item.series['label']+":" +item.series['percent'] + '%';
In the tooltip the value displays correctly.
I want to display the Alert1 value and not label value so when I write this code:
var tip = item.series['Alert1']+":"+item.series['percent']+'%';
in the tooltip the value says "undefined"
Help me out!!!