I have 3 questions about captions (data localizations):
How to provide caption for a field not included in slice object
Why are captions ignored in: toolbar -> fields -> all fields -> any measure field
Why are captions ignored while adding calculated value: toolbar -> fields -> add calculated value -> any row or column field
Check out this js fiddle
var pivot = new WebDataRocks({
container: "#wdr-component",
toolbar: true,
height: 395,
report: {
dataSource: {
filename: "https://cdn.webdatarocks.com/data/data.csv"
},
"slice": {
"rows": [{
"uniqueName": "Category",
"caption": "Category_Localized"
}
],
"columns": [{
"uniqueName": "Color",
"caption": "Color_Localized"
}],
"measures": [{
"uniqueName": "Price",
"aggregation": "sum",
"caption": "Price_Localized"
}
]
}
}
});
It seems like all these features are currently not working as expected.
As a workaround to the first question though you can simply change the field names in the CSV file you're feeding to the pivot table.
Related
I am creating a Classic layout using rows, column and measure. I want to add a static column( without doing any sum/average) as a last column. How can this be achieved?
Given the following configuration:
"rows": [
{
"uniqueName": "Type",
"sort": "desc"
},
{
"uniqueName": "SubCategory"
}
],
"columns": [
{
"uniqueName": "Month"
},
{
"uniqueName": "Measures"
}
],
"measures": [
{
"uniqueName": "Amount",
"aggregation": "sum",
"format": "02fecc33bec74ccd9c8a0835259938f0"
},
{
"uniqueName": "Budget",
"formula": "min('BudgetAmount') ",
"caption": "Budget"
}
]
How can I display “Budget” column, which is static and will be the same, only once; whilst “Amount” is categorized by “Month”?
Can you please help me with an example incase it can be achieved by creating an additional instance of WebDataRocks to display the “Budget” measure with the desired configuration? I am not sure how this can be done.TIA
There is no built-in solution because, as a general rule, the pivot table approach does not allow adding fixed columns.
As a workaround, you can create the second component with following slice:
slice: {
rows: [{
uniqueName: "Type",
sort: "desc"
},
{
uniqueName: "SubCategory"
},
],
columns: [{
"uniqueName": "[Measures]"
}],
measures: [{
uniqueName: "Budget",
formula: "min('BudgetAmount') ",
caption: "Budget",
}]
}
}
I recently took over the development of a website that uses datatables. The site is built using Laravel 4.
I am new to datatables. I was wanting to know if it were possible to have the datatable load but not display any output/rows. The information would only show up once the user fills out the search bar.
I have gone over some of the available documentation on the datatables.net but haven’t found what I am looking for.
EDIT:
Here is a code snippet:
table.dataTable({
// Internationalisation. For more info refer to http://datatables.net/manual/i18n
"language": {
"aria": {
"sortAscending": ": activate to sort column ascending",
"sortDescending": ": activate to sort column descending"
},
"emptyTable": "No data available in table",
"info": "Showing1 _START_ to _END_ of _TOTAL_ entries1",
"infoEmpty": "No entries found",
"infoFiltered": "(filtered1 from _MAX_ total entries)",
"lengthMenu": "Show _MENU_ entries",
"search": "Search:",
"zeroRecords": "No matching records found"
},
// "bStateSave": true, // save datatable state(pagination, sort, etc) in cookie.
"columns": [{
"orderable": true
},{
"orderable": true
},{
"orderable": true
}, {
"orderable": false
}],
"lengthMenu": [
[5, 10, 20, 100, -1],
[5, 10, 20, 100, "All"] // change per page values here
],
// set the initial value
"pageLength": 10,
"pagingType": "bootstrap_full_number",
"language": {
"search": "Search Patient: ",
"lengthMenu": " _MENU_ records",
"paginate": {
"previous":"Prev",
"next": "Next",
"last": "Last",
"first": "First"
}
},
"columnDefs": [{ // set default column settings
'orderable': false,
'targets': [0]
}, {
"searchable": false,
"targets": [1]
}, { // set default column settings
'orderable': false,
"bVisible": false,
'targets': [4]
}],
"order": [
[4, "asc"]
] // set 5th column as a default sort by asc
});
Take a look at the Server-side processing example.
Let Laravel return an empty array by default so the table data is empty. It will call the ajax script on every "change" so once a user searches for anything, you can return the queried data.
More examples and docs can be found here: https://datatables.net/examples/server_side/index.html
If you're using a package, you should also check the documentation for that version.
Here is my fiddle!
I dont want to show compare to block and i tried with making comaparable to false, but this didn't work.
"stockGraphs": [ {
"id": "g1",
"valueField": "value",
"comparable": false,
"compareField": "value",
"balloonText": "[[title]]:<b>[[value]]</b>",
"compareGraphBalloonText": "[[title]]:<b>[[value]]</b>"
} ],
You can set compared to true in your other datasets (ignore the first one as it is always displayed by default) to show the datasets without using the selector:
"dataSets": [ {
"title": "first data set",
"fieldMappings": [ {
"fromField": "value",
"toField": "value"
}, {
"fromField": "volume",
"toField": "volume"
} ],
"dataProvider": chartData1,
//don't set compared in the first dataset or it will be displayed twice
"categoryField": "date"
}, {
"title": "second data set",
"fieldMappings": [ {
"fromField": "value",
"toField": "value"
}, {
"fromField": "volume",
"toField": "volume"
} ],
"dataProvider": chartData2,
"compared": true,
"categoryField": "date"
},
// ... etc
If you want to display the other datasets without the percent change, set recalculateToPercents to "never" in your desired panel(s) or globally in panelsSettings.
Updated fiddle
Edit
If you're looking to just hide the "Compare To": section, add the following CSS:
.amcharts-compare-div {
display: none;
}
/* hide the br tags before and after the dropdown, brining the compare to box up */
.amcharts-data-set-selector-div br:first-child, .amcharts-data-set-selector-div br+select+br, .amcharts-data-set-selector-div br+select+br+br {
display: none;
}
You also need to set the dataSetSelector's compareText property to an empty string.
Updated fiddle
I am currently working with a Kendo UI PivotGrid. I ran into an issue where I do not want to display the "All" column. This is the Grand Total column that contains some aggregates of the data in your grid. The screenshot shows only the "All" column but there is another additional row at the very bottom with aggregate data. In code it is referred to as "measures" of the grid. I do not want to view these summations but when I remove the "aggregate" property from the measures the grid does not populate. Does anyone know of a way to hide this aggregate column and row? Here is the JavaScript code that I am using to initialize this grid as well as a screenshot:
var pivotgrid = $(divid).kendoPivotGrid({
dataSource: {
data: result,
schema: {
cube: {
measures: { "Data": { field: "Data", format: "{0:n6}", aggregate: "sum" }
}
}
},
columns: [{ name: "Date", expand: true }],
rows: [{ name: "AcctCd", expand: true }],
measures: ["Data"]
}
}).data("kendoPivotGrid");
I have a Kendo TreeList. I'm trying to lock the first column like this:
columns: [
{ field: "field1", title: "Field 1", locked: true },
{ field: "field2", title: "Field 2" }
]
With the locked:true there, however, my TreeList doesn't even load. What might I be missing?
It seems you must specify the field widths in order for column locking to work. In addition, the columns to the right of the locked column(s) must fill up enough width to cause the scrolling to engage.
columns: [
{ field: "field1", title: "Field 1", locked: true, width:200 },
{ field: "field2", title: "Field 2", width: 1000 }
]