Nested child elements not displaying in JSON column formatting in Microsoft List in SharePoint Online - sharepoint-online

I am trying to create a Status column which displays the progress of a multi stage approval flow.
This JSFiddle demonstrates how it should look:
I am now converting the HTML and CSS into the JSON required for column formatting.
All the conditional logic and colors are working, however it is not outputting the nested child elements.
The nested child elements (spans) are the 'arrows' at the end of each stage.
The column formatting therefore looks like this:
The associated HTML in browser developer tools console looks like this:
(you can see that the nested spans are not being output at all)
At first, I was wondering if nested children were allowed in JSON column formatting.
But I have seen other examples where people are using it (example), so that doesn't seem to be the issue.
Below is the JSON column formatting I am using.
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
"elmType": "div",
"style":
{
"font-size": "16px"
},
"children":
[
{
"elmType": "div",
"txtContent": "Stage 01",
"style":
{
"float": "left",
"padding": "10px 30px 10px 40px",
"position": "relative",
"font-family": "Arial",
"background-color": "=if([$Stage1Person] == '', '#eee', '#aeffae')"
},
"children":
[
{
"elmType": "span",
"style":
{
"position": "absolute",
"top": "0",
"right": "-19px",
"width": "0",
"height": "0",
"border-top": "21px solid transparent",
"border-bottom": "20px solid transparent",
"z-index": "2",
"background-color": "=if([$Stage1Person] == '', '#eee', '#aeffae')"
}
}
]
},
{
"elmType": "div",
"txtContent": "Stage 02",
"style":
{
"float": "left",
"padding": "10px 30px 10px 40px",
"position": "relative",
"font-family": "Arial",
"background-color": "=if([$Stage2Person] == '', '#ffdcae', '#aeffae')"
},
"children":
[
{
"elmType": "span",
"style":
{
"position": "absolute",
"top": "0",
"right": "-19px",
"width": "0",
"height": "0",
"border-top": "21px solid transparent",
"border-bottom": "20px solid transparent",
"z-index": "2",
"background-color": "=if([$Stage2Person] == '', '#ffdcae', '#aeffae')"
}
}
]
},
{
"elmType": "div",
"txtContent": "Stage 03",
"style":
{
"float": "left",
"padding": "10px 30px 10px 40px",
"position": "relative",
"font-family": "Arial",
"background-color": "=if([$Stage3Person] == '', '#ffaeae', '#aeffae')"
},
"children":
[
{
"elmType": "span",
"style":
{
"position": "absolute",
"top": "0",
"right": "-19px",
"width": "0",
"height": "0",
"border-top": "21px solid transparent",
"border-bottom": "20px solid transparent",
"z-index": "2",
"background-color": "=if([$Stage3Person] == '', '#ffaeae', '#aeffae')"
}
}
]
}
]
}
Simplified JSON
Here is a more simplified version which also demonstrates how the nested CHILD elements are not being output as HTML:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
"elmType": "div",
"style":
{
"font-size": "16px"
},
"children":
[
{
"elmType": "div",
"txtContent": "Stage 01",
"style":
{
"float": "left",
"padding": "10px 30px 10px 40px",
"position": "relative",
"font-family": "Arial",
"background-color": "=if([$Stage1Person] == '', '#eee', '#aeffae')"
},
"children":
[
{
"elmType": "span",
"txtContent": "Stage 01 - CHILD"
}
]
},
{
"elmType": "div",
"txtContent": "Stage 02",
"style":
{
"float": "left",
"padding": "10px 30px 10px 40px",
"position": "relative",
"font-family": "Arial",
"background-color": "=if([$Stage2Person] == '', '#ffdcae', '#aeffae')"
},
"children":
[
{
"elmType": "span",
"txtContent": "Stage 02 - CHILD"
}
]
},
{
"elmType": "div",
"txtContent": "Stage 03",
"style":
{
"float": "left",
"padding": "10px 30px 10px 40px",
"position": "relative",
"font-family": "Arial",
"background-color": "=if([$Stage3Person] == '', '#ffaeae', '#aeffae')"
},
"children":
[
{
"elmType": "span",
"txtContent": "Stage 03 - CHILD"
}
]
}
]
}

Related

Thumbnail View on Sharepoint 2016 Document Library

is it possible to change view from list to thumbnail on document library sharepoint 2016?
I've searched for documentation on google, youtube, microsoft still can't find the answer, please help. Currently the display of the user is still a list
You could achieve this by using view formatting.
Make sure your library contains 'Type', 'Create by' and 'Type' column.
1.View -> formatting current view -> Prase following code.
enter image description here
2.Choose layout to 'Gallery'-> save.
code template:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json Jump ",
"tileProps": {
"hideSelection": true,
"height": "280",
"width": "300",
"formatter": {
"elmType": "div",
"style": {
"align-items": "stretch",
"margin": "3px 2px",
"background-color": "#fbfbfb",
"height": "380px",
"overflow": "inherit",
"border-radius": "2px",
"box-shadow": "0px 1.6px 3.6px 0 #00000024, 0px 0.3px 0.9px 0 #00000024"
},
"children": [
{
"elmType": "div",
"style": {
"display": "flex",
"flex-wrap": "wrap",
"position": "relative",
"padding-bottom": "10px",
"width": "100%"
},
"children": [
{
"elmType": "div",
"style": {
"margin-top": "0px",
"height": "200px",
"display": "block",
"align-items": "center",
"justify-content": "center",
"position": "relative",
"border-bottom": "1px solid #EEE",
"overflow": "hidden",
"border-radius": "2px 2px 0 0"
},
"children": [
{
"elmType": "button",
"style": {
"position": "absolute",
"height": "100%",
"width": "100%",
"opacity": "0",
"cursor": "pointer"
},
"customRowAction": {
"action": "defaultClick"
}
},
{
"elmType": "div",
"style": {
"width": "=if([$File_x0020_Type] == '', '100px', '100%')",
"height": "=if([$File_x0020_Type] == '', '100px', '100%')",
"oveflow": "=if([$File_x0020_Type] == '', 'auto', 'hidden')",
"text-align": "center",
"overflow": "hidden"
},
"children": [
{
"elmType": "img",
"style": {
"height": "=if([$File_x0020_Type] == '', '100%', '0'"
},
"attributes": {
"src": "=if([$File_x0020_Type] == '', 'https://spoprod-a.akamaihd.net/files/fabric/office-ui-fabric-react-assets/foldericons-fluent/folder-large_frontplate_nopreview.svg Jump ', '')"
}
},
{
"elmType": "img",
"style": {
"display": "=if([$File_x0020_Type] == '', 'none', '')"
},
"attributes": {
"src": "#thumbnail.383x383"
}
}
]
}
]
},
{
"elmType": "div",
"style": {
"margin": "25px 0 0 0",
"position": "absolute",
"top": "153px",
"width": "100%",
"color": "#333333"
},
"attributes": {
"class": "ms-fontSize-14 ms-fontWeight-semibold"
},
"children": [
{
"elmType": "img",
"attributes": {
"src": "=if([$File_x0020_Type] == 'docx', 'https://spoprod-a.akamaihd.net/files/fabric/assets/item-types-fluent/20/docx.svg?v6 Jump ', if([$File_x0020_Type] == 'xlsx', 'https://spoprod-a.akamaihd.net/files/fabric/assets/item-types-fluent/20/xlsx.svg?v6 Jump ', if([$File_x0020_Type] == 'pptx', 'https://spoprod-a.akamaihd.net/files/fabric/assets/item-types-fluent/20/pptx.svg?v6 Jump ', if([$File_x0020_Type] == 'pdf', 'https://spoprod-a.akamaihd.net/files/fabric/assets/item-types-fluent/20/pdf.svg?v6 Jump ', if([$File_x0020_Type] == 'jpg' || [$File_x0020_Type] == 'png' || [$File_x0020_Type] == 'gif','https://spoprod-a.akamaihd.net/files/fabric/assets/item-types-fluent/20/photo.svg?v6 Jump ', if([$File_x0020_Type] == 'mp4' || [$File_x0020_Type] == 'avi' || [$File_x0020_Type] == 'mov', 'https://spoprod-a.akamaihd.net/files/fabric/assets/item-types-fluent/20/video.svg?v6 Jump ', if([$File_x0020_Type] == 'zip', 'https://spoprod-a.akamaihd.net/files/fabric/assets/item-types-fluent/20/zip.svg?v6 Jump ','Unknown')))))))"
},
"style": {
"flex": "none",
"line-height": "100%",
"font-weight": "normal",
"font-size": "2rem",
"margin": "5px 5px 5px 10px",
"height": "25px"
}
},
{
"elmType": "div",
"txtContent": "[$FileLeafRef]",
"style": {
"padding": "0 0 0 16px"
}
},
{
"elmType": "div",
"txtContent": "='edited by ' + [$Editor.title]",
"style": {
"padding": "0 0 0 16px"
}
}
]
}
]
}
]
}
}
}

MS Lists Lookup column not found in data object

I have two lists A and B. I've created a lookup column on B to get data from A (item # and item address). I want to customize the view when opening an item on list B. But I can't find a way to make the fields from A visible on B. I get
Failure: TEST_x0020_SHIPPING_x0020_ADDRES1 was not found on the data object.
I checked the name of the field and it's correct and contains data. Please check the attached image. Is there a way to get that information on that view?
Note: if I disable debug it shows nothing.
Thanks in advance!
JSONERROR
Update: The code I'm using on the Header comes from the MS official site https://learn.microsoft.com/en-us/sharepoint/dev/declarative-customization/list-form-configuration
{
"debugMode": false,
"elmType": "div",
"attributes": {
"class": "ms-borderColor-neutralTertiary"
},
"style": {
"width": "99%",
"border-top-width": "0px",
"border-bottom-width": "1px",
"border-left-width": "0px",
"border-right-width": "0px",
"border-style": "solid",
"margin-bottom": "16px"
},
"children": [
{
"elmType": "div",
"style": {
"display": "flex",
"box-sizing": "border-box",
"align-items": "center"
},
"children": [
{
"elmType": "div",
"attributes": {
"iconName": "Devices3",
"class": "ms-fontSize-42 ms-fontWeight-regular ms-fontColor-themePrimary",
"title": "Details"
},
"style": {
"flex": "none",
"padding": "0px",
"padding-left": "0px",
"height": "36px"
}
}
]
},
{
"elmType": "div",
"attributes": {
"class": "ms-fontColor-neutralSecondary ms-fontWeight-bold ms-fontSize-24"
},
"style": {
"box-sizing": "border-box",
"width": "100%",
"text-align": "left",
"padding": "21px 12px",
"overflow": "hidden"
},
"children": [
{
"elmType": "div",
"txtContent": "='Store ' + [$TEST_x0020_SHIPPING_x0020_ADDRES1]"
}
]
}
]
}

Tabulator isn't adjusting the height of the column header if the header is nested

tabulator version: 4.8
I've tried it for hours, but I am stuck.
The height of the column header isn't auto-adjusted in the header second line. So important text for a column is hidden.
So, if you have a very long header title like "Anzahl Böden" or "Tragkraft pro Boden" you only see the first word if your screen size is not big enough.
/* tabulator */
var locale_number_formatter = function(cell, formatterParams, onRendered){
var nf = new Intl.NumberFormat();
return nf.format( cell.getValue() );
}
function is_mobile() {
var is_mobile = true;
if ($(window).width() >= 768) {
is_mobile = false;
}
return is_mobile;
}
.is-hidden
{
display: none;
}
.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-title {
white-space: normal !important;
text-overflow: clip;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/tabulator/4.8.4/css/tabulator.min.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tabulator/4.8.4/js/tabulator.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<h1>
Table test
</h1>
<div id="product-table-2371">
</div>
<div id="hidden-table-2371">
</div>
<script>
document.addEventListener("DOMContentLoaded", function(event) {
var cart_formatter_2371 = function(cell, formatterParams, onRendered) {
return '<button title="In den Warenkorb" class="button cart-table-button cart-table-button-2371 is-primary has-text-white is-size-7 modal-button" data-object-id="238" data-attribute-id="2371" data-variation-id="' + cell.getValue() + '" aria-haspopup="true" data-table-id="table_2371">Warenkorb</button>';
};
var responsive_layout_formatter_2371 = function(data) {
//data - an array of objects containing the column title and value for each cell
var table_data = [];
data.forEach(function(col) {
table_data.push({
'column': col.title,
celldata: col.value
});
});
var responsive_table_2371 = Tabulator.prototype.findTable("#hidden-table-2371")[0];
if (!responsive_table_2371) {
responsive_table_2371 = new Tabulator("#hidden-table-2371", {
tooltips: true,
autoColumns: true,
"headerVisible": false,
layout: 'fitColumns',
tooltipGenerationMode: "hover",
tooltipsHeader: true,
data: table_data
});
} else {
responsive_table_2371.clearData();
responsive_table_2371.clearFilter();
responsive_table_2371.setData(table_data);
}
//var table_html = responsive_table_2371.tabulator( "getHtml" );
var table_html = '';
return Object.keys(data).length ? table_html : "";
}
var cart_button_cell_click_2371 = function(e, cell) {
// dummy
};
var columns_json_2371 = [{
"title": "",
"tooltip": "",
"cssClass": "tabulator-header-row-level-2",
"columns": [{
"formatter": "plaintext",
"field": "no",
"title": "Nr.",
"hozAlign": "right",
"vertAlign": "middle",
"width": 60,
"resizable": false,
"responsive": 2
}, {
"field": "height",
"cssClass": "tabulator-col-height",
"title": "H\u00f6he",
"tooltip": "H\u00f6he in mm",
"sorter": "number",
"formatter": locale_number_formatter,
"titleFormatter": "textarea",
"variableHeight": true,
"hozAlign": "right",
"vertAlign": "middle",
"responsive": 2
}, {
"field": "length",
"cssClass": "tabulator-col-length",
"title": "L\u00e4nge",
"tooltip": "L\u00e4nge in mm",
"sorter": "number",
"formatter": locale_number_formatter,
"titleFormatter": "textarea",
"variableHeight": true,
"hozAlign": "right",
"vertAlign": "middle",
"responsive": 2
}, {
"field": "depth",
"cssClass": "tabulator-col-depth",
"title": "Tiefe",
"tooltip": "Tiefe in mm",
"sorter": "number",
"formatter": locale_number_formatter,
"titleFormatter": "textarea",
"variableHeight": true,
"hozAlign": "right",
"vertAlign": "middle",
"responsive": 2
}, {
"field": "lowershelf",
"cssClass": "tabulator-col-lowershelf",
"title": "Anzahl B\u00f6den",
"tooltip": "Anzahl der Fachb\u00f6den pro Regalfeld",
"sorter": "number",
"formatter": locale_number_formatter,
"titleFormatter": "textarea",
"variableHeight": true,
"hozAlign": "right",
"vertAlign": "middle",
"responsive": 2
}, {
"field": "tragkraft_pro_boden",
"cssClass": "tabulator-col-tragkraft_pro_boden",
"title": "Tragkraft pro Boden",
"tooltip": "Tragkraft pro Boden in kg",
"sorter": "string",
"formatter": "plaintext",
"titleFormatter": "textarea",
"variableHeight": true,
"hozAlign": "right",
"vertAlign": "middle",
"responsive": 2
}]
}, {
"title": "Grundregal",
"tooltip": "Hier steht das Grundregal",
"cssClass": "tabulator-header-row-level-2",
"columns": [{
"field": "sku",
"cssClass": "tabulator-col-sku",
"title": "Art.Nr.",
"tooltip": "Artikelnummer des Produkts",
"sorter": "alphanum",
"formatter": "plaintext",
"titleFormatter": "textarea",
"variableHeight": true,
"hozAlign": "right",
"vertAlign": "middle",
"responsive": 2
}, {
"field": "price",
"cssClass": "tabulator-col-price",
"title": "Preis",
"tooltip": "Produktpreis",
"sorter": "number",
"formatter": "money",
"titleFormatter": "textarea",
"variableHeight": true,
"formatterParams": {
"decimal": ",",
"thousand": ".",
"symbol": " \u20ac",
"symbolAfter": true,
"precision": "2"
},
"hozAlign": "right",
"vertAlign": "middle",
"responsive": 2
}, {
"field": "cart",
"formatter": cart_formatter_2371,
"cellClick": cart_button_cell_click_2371,
"hozAlign": "center",
"vertAlign": "middle",
"tooltip": "In den Warenkorb",
"title": "",
"cssClass": "tabulatur-background-price",
"headerSort": false,
"responsive": 2
}]
}, {
"title": "Anbauregal",
"tooltip": "Hier ist das Anbauregal",
"cssClass": "tabulator-header-row-level-2",
"columns": [{
"field": "sku_1",
"formatter": "plaintext",
"hozAlign": "center",
"vertAlign": "middle",
"sorter": "alphanum",
"title": "Art.Nr.",
"tooltip": "Artikelnummer des Produkts",
"cssClass": "tabulatur-background-anbauregal",
"responsive": 2
}, {
"field": "price_1",
"formatter": "money",
"hozAlign": "center",
"vertAlign": "middle",
"sorter": "number",
"title": "Preis",
"cssClass": "tabulatur-background-anbauregal",
"formatterParams": {
"decimal": ",",
"thousand": ".",
"symbol": " \u20ac",
"symbolAfter": true,
"precision": "2"
},
"responsive": 2
}, {
"field": "cart_1",
"formatter": cart_formatter_2371,
"cellClick": cart_button_cell_click_2371,
"hozAlign": "center",
"vertAlign": "middle",
"tooltip": "In den Warenkorb",
"title": "",
"cssClass": "tabulatur-background-anbauregal",
"headerSort": false,
"responsive": 2
}]
}];
var tabledata_2371 = [{
"height": "2000",
"length": "1000",
"depth": "300",
"lowershelf": "5",
"tragkraft_pro_boden": "250 kg",
"sku": "S2626",
"price": "145",
"cart": "307831",
"sku_1": "S2646",
"price_1": "108.1",
"cart_1": "307847",
"no": 1
}, {
"height": "2000",
"length": "1000",
"depth": "400",
"lowershelf": "5",
"tragkraft_pro_boden": "250 kg",
"sku": "S2627",
"price": "154.7",
"cart": "307832",
"sku_1": "S2647",
"price_1": "117.1",
"cart_1": "307848",
"no": 2
}, {
"height": "2000",
"length": "1000",
"depth": "500",
"lowershelf": "5",
"tragkraft_pro_boden": "250 kg",
"sku": "S2628",
"price": "173.2",
"cart": "307833",
"sku_1": "S2648",
"price_1": "134.6",
"cart_1": "307849",
"no": 3
}, {
"height": "2000",
"length": "1000",
"depth": "600",
"lowershelf": "5",
"tragkraft_pro_boden": "250 kg",
"sku": "S2629",
"price": "189.2",
"cart": "307834",
"sku_1": "S2649",
"price_1": "149.6",
"cart_1": "307850",
"no": 4
}, {
"height": "2000",
"length": "1000",
"depth": "800",
"lowershelf": "5",
"tragkraft_pro_boden": "250 kg",
"sku": "S2630",
"price": "213.5",
"cart": "307835",
"sku_1": "S2650",
"price_1": "171.7",
"cart_1": "307851",
"no": 5
}, {
"height": "2000",
"length": "1300",
"depth": "300",
"lowershelf": "5",
"tragkraft_pro_boden": "250 kg",
"sku": "S2633",
"price": "178.3",
"cart": "307836",
"sku_1": "S2653",
"price_1": "140.5",
"cart_1": "307852",
"no": 6
}, {
"height": "2000",
"length": "1300",
"depth": "400",
"lowershelf": "5",
"tragkraft_pro_boden": "250 kg",
"sku": "S2634",
"price": "194.3",
"cart": "307837",
"sku_1": "S2654",
"price_1": "155.8",
"cart_1": "307853",
"no": 7
}, {
"height": "2000",
"length": "1300",
"depth": "500",
"lowershelf": "5",
"tragkraft_pro_boden": "250 kg",
"sku": "S2635",
"price": "218.9",
"cart": "307838",
"sku_1": "S2655",
"price_1": "179.3",
"cart_1": "307854",
"no": 8
}, {
"height": "2000",
"length": "1300",
"depth": "600",
"lowershelf": "5",
"tragkraft_pro_boden": "250 kg",
"sku": "S2636",
"price": "236",
"cart": "307839",
"sku_1": "S2656",
"price_1": "195.5",
"cart_1": "307855",
"no": 9
}, {
"height": "2000",
"length": "1300",
"depth": "800",
"lowershelf": "5",
"tragkraft_pro_boden": "250 kg",
"sku": "S2637",
"price": "300.3",
"cart": "307840",
"sku_1": "S2657",
"price_1": "257.6",
"cart_1": "307856",
"no": 10
}, {
"height": "3000",
"length": "1300",
"depth": "500",
"lowershelf": "7",
"tragkraft_pro_boden": "250 kg",
"sku": "S2715",
"price": "322",
"cart": "307898",
"sku_1": "S2735",
"price_1": "258.9",
"cart_1": "307912",
"no": 38
}, {
"height": "3000",
"length": "1300",
"depth": "600",
"lowershelf": "7",
"tragkraft_pro_boden": "250 kg",
"sku": "S2716",
"price": "346.2",
"cart": "307899",
"sku_1": "S2736",
"price_1": "281.6",
"cart_1": "307913",
"no": 39
}, {
"height": "3000",
"length": "1300",
"depth": "800",
"lowershelf": "7",
"tragkraft_pro_boden": "250 kg",
"sku": "S2717",
"price": "436.6",
"cart": "307900",
"sku_1": "S2737",
"price_1": "368.7",
"cart_1": "307914",
"no": 40
}, {
"height": "3000",
"length": "1000",
"depth": "300",
"lowershelf": "7",
"tragkraft_pro_boden": "330 kg",
"sku": "S2961",
"price": "239.6",
"cart": "307901",
"sku_1": "S2971",
"price_1": "180.8",
"cart_1": "307915",
"no": 41
}, {
"height": "3000",
"length": "1000",
"depth": "400",
"lowershelf": "7",
"tragkraft_pro_boden": "330 kg",
"sku": "S2962",
"price": "263.2",
"cart": "307902",
"sku_1": "S2972",
"price_1": "203.5",
"cart_1": "307916",
"no": 42
}, {
"height": "3000",
"length": "1000",
"depth": "500",
"lowershelf": "7",
"tragkraft_pro_boden": "330 kg",
"sku": "S2963",
"price": "291.5",
"cart": "307903",
"sku_1": "S2973",
"price_1": "230.2",
"cart_1": "307917",
"no": 43
}, {
"height": "3000",
"length": "1000",
"depth": "600",
"lowershelf": "7",
"tragkraft_pro_boden": "330 kg",
"sku": "S2964",
"price": "316.1",
"cart": "307904",
"sku_1": "S2974",
"price_1": "253.2",
"cart_1": "307918",
"no": 44
}, {
"height": "3000",
"length": "1000",
"depth": "800",
"lowershelf": "7",
"tragkraft_pro_boden": "330 kg",
"sku": "S2965",
"price": "349.5",
"cart": "307919",
"sku_1": "S2975",
"price_1": "283.5",
"cart_1": "307920",
"no": 45
}];
var table_layout_2371 = 'fitColumns';
var paginationSize_2371 = 10;
if (is_mobile()) {
table_layout_2371 = 'fitData';
paginationSize_2371 = 1;
}
var table_2371 = new Tabulator("#product-table-2371", {
"data": tabledata_2371,
"locale": "de-de",
"columnHeaderVertAlign": "bottom",
"langs": {
"de-de": {
"pagination": {
"page_size": "Einträge pro Seite",
"page_title": "Seite anzeigen",
"first": "Erste",
"first_title": "Erste Seite",
"last": "Letzte",
"last_title": "Letzte Seite",
"prev": "Zurück",
"prev_title": "Zurück",
"next": "Weiter",
"next_title": "Nächste Seite",
"all": "Alle"
}
}
},
"tooltips": true,
"pagination": 'local',
"paginationSize": paginationSize_2371,
"paginationSizeSelector": true,
"paginationSizeSelector": [1, 5, 10, 25, 50, 100],
"responsiveLayout": "collapse",
"layout": table_layout_2371,
initialSort: [{
"column": "height",
"dir": "asc"
}],
"selectable": true,
"tooltipGenerationMode": "hover",
"tooltipsHeader": true,
"responsiveLayoutCollapseFormatter": responsive_layout_formatter_2371,
"columns": columns_json_2371
});
table_2371.clearData();
table_2371.clearFilter();
table_2371.setData(tabledata_2371);
var table_filter_2371 = $(".product-filter-2371");
if (table_filter_2371.length) {
table_filter_2371.change(function() {
table_2371.clearFilter();
var filter_array_2371 = [];
$(".product-filter-2371").each(function() {
if ($(this).val() !== '') {
filter_array_2371.push({
'field': $(this).data('column'),
'type': '=',
'value': $(this).val()
});
}
});
table_2371.setFilter(filter_array_2371);
});
}
});
</script>
Any ideas?
Best,
Georg.

ZingChart Labels disappeared when updating script to 2.5.2

I updated our instance of the ZingChart script to version 2.5.2 today and doing so caused labels to disappear from a chart where they previously showed. I'm not sure if it's an issue with my JSON that just managed not to throw any errors in the previous version of ZingChart or if it's a bug with the current release.
Before:
After:
My JSON:
var maxYValue = 60;
var value1 = 40;
var value2 = 15;
var value3 = 34;
var value4 = 14;
var value5 = 20;
var zones_1 = {
"type": "mixed",
"font-family": "proxima_nova_rgregular",
"title": {
"text": "MINUTES <b>IN ZONES</b>",
"font-family": "proxima_nova_rgregular",
"background-color": "none",
"font-color": "#39393d",
"font-size": "22px",
"adjustLayout": true,
"padding-bottom": 50
},
"plot": {
"borderRadius": "5px 5px 0 0",
"bar-width": '50%',
"animation": {
"delay": 300,
"effect": 11,
"speed": "500",
"method": "0",
"sequence": "3",
"z-index": 2
},
"value-box": {
"placement": "top-out",
"text": "%v",
"decimals": 0,
"font-color": "#35353b",
"font-size": "14px",
"alpha": 1,
"backgroundColor": "#ffffff",
"padding": "5px 5px 0px 5px",
"shadow": false
}
},
"plotarea": {
"border-left": "3px solid #39393d",
"border-bottom": "3px solid #39393d",
"padding-left": "3px",
"margin": "dynamic",
"background-color": "none"
},
"tooltip": {
"visible": false
},
"scale-x": {
"placement": "opposite",
"line-width": 0,
"tick": {
"visible": false
},
"guide": {
"visible": false
},
"item": {
"visible": false
},
},
"scale-y": {
"offsetEnd": 45,
"max-value": maxYValue,
"visible": false,
"line-width": 0,
"guide": {
"visible": false
}
},
"series": [
{
"type": "bar",
"values": [
value1, value2, value3, value4, value5
],
"background-color": "#cdcccc",
"z-index": 2,
"styles": ['#cdcccc', '#71cbdc', '#8cc541', '#d96c27', '#ea2629']
},
{
"type": "line",
"line-color": "grey",
"marker": { "visible": 0 },
"value-box": { visible: 0 },
"values": [
[0, value1 + 2],
[0, maxYValue],
[0, null],
[1, value2 + 2],
[1, maxYValue],
[1, null],
[2, value3 + 2],
[2, maxYValue],
[2, null],
[3, value4 + 2],
[3, maxYValue],
[3, null],
[4, value5 + 2],
[4, maxYValue],
[4, null],
]
}
],
"labels": [
{
"text": "Zone 1",
"font-size": "13px",
"padding": "10px 5px",
"borderWidth": 1,
"borderColor": "#ffffff",
"backgroundColor": "#ffffff",
"callout": true,
"calloutWidth": 0,
"calloutHeight": 5,
'hook': 'scale:name=scale-x,index=0',
'offset-y': -200,
"calloutTip": {
'offset-y': -200,
"type": "circle",
"background-color": "#fff",
"border-width": 2,
"border-color": "#35353b",
"size": 7,
"shadow": false
}
},
{
"text": "Zone 2",
"font-size": "13px",
"padding": "10px 5px",
"borderWidth": 1,
"borderColor": "#ffffff",
"backgroundColor": "#ffffff",
"callout": true,
"calloutWidth": 0,
"calloutHeight": 5,
'hook': 'scale:name=scale-x,index=1',
'offset-y': -200,
"calloutTip": {
'offset-y': -200,
"type": "circle",
"background-color": "#fff",
"border-width": 2,
"border-color": "#35353b",
"size": 7,
"shadow": false
}
},
{
"text": "Zone 3",
"font-size": "13px",
"padding": "10px 5px",
"borderWidth": 1,
"borderColor": "#ffffff",
"backgroundColor": "#ffffff",
"callout": true,
"calloutWidth": 0,
"calloutHeight": 5,
'hook': 'scale:name=scale-x,index=2',
'offset-y': -200,
"calloutTip": {
'offset-y': -200,
"type": "circle",
"background-color": "#fff",
"border-width": 2,
"border-color": "#35353b",
"size": 7,
"shadow": false
}
},
{
"text": "Zone 4",
"font-size": "13px",
"padding": "10px 5px",
"borderWidth": 1,
"borderColor": "#ffffff",
"backgroundColor": "#ffffff",
"callout": true,
"calloutWidth": 0,
"calloutHeight": 5,
'hook': 'scale:name=scale-x,index=3',
'offset-y': -200,
"calloutTip": {
'offset-y': -200,
"type": "circle",
"background-color": "#fff",
"border-width": 2,
"border-color": "#35353b",
"size": 7,
"shadow": false
}
},
{
"text": "Zone 5",
"font-size": "13px",
"padding": "10px 5px",
"borderWidth": 1,
"borderColor": "#ffffff",
"backgroundColor": "#ffffff",
"callout": true,
"calloutWidth": 0,
"calloutHeight": 5,
'hook': 'scale:name=scale-x,index=4',
'offset-y': -200,
"calloutTip": {
'offset-y': -200,
"type": "circle",
"background-color": "#fff",
"border-width": 2,
"border-color": "#35353b",
"size": 7,
"shadow": false
}
}
],
}
Any help would be greatly appreciated. I would prefer to keep the most updated version of the script but really need those labels back.
I can't speak to exactly what the cause of your issue is between builds at the moment but our team will look into it. I did however look at your JSON and I think you can get the output you are looking for in an easier way. I have included an updated chart config below which does work on the newest build.
Full disclosure on the ZingChart team.
var maxYValue = 60;
var value1 = 40;
var value2 = 15;
var value3 = 34;
var value4 = 14;
var value5 = 20;
var myConfig ={
"type": "mixed",
"font-family": "proxima_nova_rgregular",
"title": {
"text": "MINUTES <b>IN ZONES</b>",
"font-family": "proxima_nova_rgregular",
"background-color": "none",
"font-color": "#39393d",
"font-size": "22px",
"adjustLayout": true,
"padding-bottom": 50
},
"plot": {
"borderRadius": "5px 5px 0 0",
"bar-width": '50%',
"animation": {
"delay": 300,
"effect": 11,
"speed": "500",
"method": "0",
"sequence": "3",
"z-index": 2
},
"value-box": {
"placement": "top-out",
"text": "%v",
"decimals": 0,
"font-color": "#35353b",
"font-size": "14px",
"alpha": 1,
"backgroundColor": "#ffffff",
"padding": "5px 5px 0px 5px",
"shadow": false
}
},
"plotarea": {
"border-left": "3px solid #39393d",
"border-bottom": "3px solid #39393d",
"padding-left": "3px",
"margin": "dynamic",
"background-color": "none"
},
"tooltip": {
"visible": false
},
"scale-x": {
"placement": "opposite",
"labels":["Zone 1","Zone 2","Zone 3","Zone 4","Zone 5"],//set zone label here. Much easier than labals:[]
"line-width": 0,
"tick": {
"visible": false
},
"guide": {
"visible": false
},
"item": {
"offsetY": 25,
"font-size": 12,
"fontColor": 'black',
"bold": true
},
},
"scale-y": {
"offsetEnd": 45,
"max-value": maxYValue,
"visible": false,
"line-width": 0,
"guide": {
"visible": false
}
},
"series": [
{
"type": "bar",
"values": [
value1, value2, value3, value4, value5
],
"background-color": "#cdcccc",
"z-index": 2,
"styles": ['#cdcccc', '#71cbdc', '#8cc541', '#d96c27', '#ea2629']
},
{
"type": "line",
"line-color": "gray",
"marker": {
"backgroundColor":"white",
"borderWidth": 3,
"borderColor":"gray",
"visible": false,
"rules":[//create marker which is always at the top of line
{
'rule':" %node-index%3 == 1 ",
visible: true,
size: 10
}
]
},
"value-box": {
visible: 0
},
"values": [
[0, value1 + 2],
[0, maxYValue],
[0, null],
[1, value2 + 2],
[1, maxYValue],
[1, null],
[2, value3 + 2],
[2, maxYValue],
[2, null],
[3, value4 + 2],
[3, maxYValue],
[3, null],
[4, value5 + 2],
[4, maxYValue],
[4, null],
]
}
]
};
zingchart.render({
id: 'myChart',
data: myConfig,
height: '100%',
width: '100%'
});
html, body {
height:100%;
width:100%;
margin:0;
padding:0;
}
#myChart {
height:100%;
width:100%;
min-height:150px;
}
.zc-ref {
display:none;
}
<!DOCTYPE html>
<html>
<head>
<script src= "https://cdn.zingchart.com/zingchart.min.js"></script>
<!--Inject End-->
</head>
<body>
<div id="myChart"><a class="zc-ref" href="https://www.zingchart.com">Powered by ZingChart</a></div>
</body>
</html>
The issue is the offset-y attribute set for the labels & the callout tip. It needs to be removed or set to zero. The new lib code is correct because scale-x has "placement": "opposite" so it is placed above (if you remove visible:false from items you will see).
Most likely the old code was not using the correct y position of the scale thats why you had to use offset-y to correct it.

Crosshair-x won't display on line chart

I am having an issue with a line chart on my site. Everything works fine about it except no matter what I try, I cannot get the crosshair-x value/scale to show up. http://gyazo.com/42a34d0fed9c2912bf7ed40eb0c55144 Both are set to "visible": true. My JSON code is as follows:
var myChart = {
"type": "line",
"background-color": "transparent",
"utc": true,
"title": {
"y": "0px",
"text": '#myClasses.STARTDATETIME.ToString("MM/d/yyyy (h:mm tt)")',
"background-color": "transparent",
"font-size": "16px",
"font-color": "#666",
"font-weight": "bold",
"letter-spacing": "0.1225em",
"height": "25px"
},
"plotarea": {
"margin":"10% 8% 14% 12%",
"background-color":"#666"
},
"legend": {
"visible": false,
},
"scale-x": {
"min-value": myEpoch,
"shadow": 0,
"step": #ViewBag.TotalTime,
"line-color": "#fff",
"tick": {
"line-color": "#f6f7f8"
},
"guide": {
"line-color": "#f6f7f8",
"visible": true
},
"item": {
"font-color": "#666"
},
"transform": {
"type": "date",
"all": "%D,%d %M<br />%h:%i %A",
"item": {
"visible": false
}
},
"label": {
"visible": false,
"font-color": "#666"
},
"minor-ticks": 0
},
"scale-y": {
"values": "25:200:25",
"line-color": "#fff",
"shadow": 0,
"tick": {
"line-color": "#f6f7f8"
},
"guide": {
"visible": false
},
"item": {
"font-color": "#666"
},
"label": {
"text": "Heart Rate (BPM)",
"font-color": "#666"
},
"minor-ticks": 0,
"thousands-separator": ",",
"markers": [
{
"type": "area",
"range": [25, 60],
"backgroundColor": "#585857",
"alpha": 1
},
{
"type": "area",
"range": [60, 95],
"backgroundColor": "#6FCBDC",
"alpha": 1
},
{
"type": "area",
"range": [95, 130],
"backgroundColor": "#8BC540",
"alpha": 1
},
{
"type": "area",
"range": [130, 165],
"backgroundColor": "#F38220",
"alpha": 1
},
{
"type": "area",
"range": [165, 200],
"backgroundColor": "#EB2026",
"alpha": 1
}
]
},
"tooltip": {
"font-color": "#666",
"visible": false
},
"chart": {
"marginRight": 30,
"marginLeft": 70
},
"plot": {
"tooltip-text": "%t bpm: %v",
"shadow": 0,
"line-width": "3px",
"marker": {
"type": "circle",
"size": 2
},
"hover-marker": {
"type": "circle",
"size": 4,
"border-width": "1px"
}
},
"series": [
{
"values": [88,96,93,88,88,86,89,120,144,153,156,132,113,145,138,152,135,155,164,165,147,143,152,140,153,138,116,125,131,132,134,124,111,136,167,171,165,168,139,129,138,130,140,141],
"text": "",
"line-color": "#ffffff",
"marker": {
"background-color": "#ffffff",
"border-width": 1,
"shadow": 0,
"border-color": "#ffffff",
"visible": true
},
"palette": 0
}
],
"crosshair-x": {
"line-color": "#f6f7f8",
"value-label": {
"border-radius": "5px",
"border-width": "1px",
"border-color": "#f6f7f8",
"padding": "0px 10px 0px 5px",
"font-weight": "bold",
"font-color": "#fff",
"background-color": "#666",
"visible": true
},
"scale-label": {
"font-color": "#fff",
"background-color": "#666",
"border-radius": "5px",
"border-width": "1px",
"border-color": "#f6f7f8",
"padding": "0px 10px 0px 5px",
"visible": true
}
}
};
Is there anything obvious that I'm missing that may be overruling those being set to visible?
Thanks in advance for your help!
Which version of ZingChart are you using? Does this occur in all browsers? Are you getting any console errors? I've taken your code and put it into our demo tool, and the crosshair seems to work. Take a look here.
You can try adding the following to the <head> element of your application:
<style title="zingchart"></style>
This forces ZingChart to inject its CSS into that element, preventing certain types of conflicts that can occur from time to time, but I'm not 100% sure that this is the issue.
I'm on the ZingChart support team, so I'd love to help, but I can't reproduce the issue on my end.

Resources