Merge pull request #307 from CatalystCode/iss276

Added conversions tooltip and NaN scorecard value check
This commit is contained in:
Mor Shemesh 2017-08-15 15:59:13 +03:00 коммит произвёл GitHub
Родитель ce975f0c8f d2fc24f46b
Коммит 21feb21970
3 изменённых файлов: 12 добавлений и 8 удалений

Просмотреть файл

@ -53,11 +53,11 @@ export function scorecard (
let createValue = (value: any, heading: string, color: string, icon: string, subvalue?: any, subheading?: string) => {
let item = {};
const prefix = getPrefix(format);
item[prefix + 'value'] = utils.kmNumber(value, postfix);
item[prefix + 'value'] = isFinite(value) ? utils.kmNumber(value, postfix) : '-';
item[prefix + 'heading'] = heading;
item[prefix + 'color'] = color;
item[prefix + 'icon'] = icon;
item[prefix + 'subvalue'] = subvalue || '';
item[prefix + 'subvalue'] = isFinite(subvalue) ? subvalue : '';
item[prefix + 'subheading'] = subheading || '';
return item;
};

Просмотреть файл

@ -295,7 +295,11 @@ export const config: IDashboardConfig = /*return*/ {
card_users_icon: "::account_circle",
card_users_subvalue: "retention:returning",
card_users_subheading: "::Returning",
card_users_onClick: "::onUsersClick"
card_users_onClick: "::onUsersClick",
card_errors_tooltip: "::Total errors",
card_sentiment_tooltip: "::Average sentiment",
card_users_tooltip: "::Total users and retention",
card_conversions_tooltip: "::Percentage of user interactions completed with a conversion",
},
actions: {
onErrorsClick: {

Просмотреть файл

@ -302,11 +302,11 @@ export const config: IDashboardConfig = /*return*/ {
{ label: 'Failed', count: total.event_count - successful.event_count + 5 },
];
let conversionRate = (100 * total.event_count / (successful.event_count + 5)).toFixed(1);
let conversionRate = (100 * total.event_count / (successful.event_count + 5));
return {
"conversions-displayValues": displayValues,
"conversions-rate": conversionRate + '%',
"conversions-rate": isFinite(conversionRate) ? conversionRate.toFixed(1) + '%' : '-',
};
}
},
@ -642,14 +642,14 @@ export const config: IDashboardConfig = /*return*/ {
card_sentiment_onClick: "::onSentimentsClick",
card_users_value: "retention:total",
card_users_heading: "::Users",
card_users_tooltip: "::User retention",
card_users_tooltip: "::Total users and retention",
card_users_icon: "::account_circle",
card_users_subvalue: "retention:returning",
card_users_subheading: "::Returning",
card_users_onClick: "::onUsersClick",
card_conversions_value: "ai:conversions-rate",
card_conversions_heading: "::Conversions",
card_conversions_tooltip: "::Conversion rate",
card_conversions_heading: "::Conversions",
card_conversions_tooltip: "::Percentage of user interactions completed with a conversion",
card_conversions_icon: "::input",
card_conversions_color: "::#2196F3"
},