Comments (6)
Sure, we want to create a dashboard about ad metrics and would like to have a table (among other charts) showing spending and performance stats (like ad spent amount, impressions and click-through rate) per campaign as well as totals on the bottom (or top). The thing is that some of those metrics have an easy grand total (like amount spent or impressions). For others, however, we would need a formula for example CTR is clicks / impressions. So it would need to work with the Math modifiers (as far as I understand we could load the impressions and clicks columns and create a third column using this modifier). Let me know if this makes sense or if you have any questions.
from highcharts.
Thank you both @peterlaczkorailsware @mcmastermind!
This gives us perspective on what you need!
from highcharts.
Hi @mcmastermind!
Thank you for sharing this idea! Right now we are in the process of defining what can be changed/improved in the datagrid so your input is very valuable to us!
To clarify, by footer do you mean something like this:
What would you like to show in the footer?
from highcharts.
Hey @karolkolodziej, I'm not the issue submitter but for us (currently evaluating HighCharts and starting a PoC) something like what you posted would be really valuable.
from highcharts.
Thank you @peterlaczkorailsware for your feedback.
Could you please provide more details on your specific requirements and how you envision this feature working for your use case?
from highcharts.
@karolkolodziej, I was able to come up with my own solution using the DataGrid resize event callback to fire a method that iterates over the rendered columns and adds the footer to the DataGrid component. The resize event is used because it fires after the grid is completely rendered and the component is set in Dashboards.boards.
Fortunately, my data is very static numbers, so a straight aggregate works well for me. I also added extra properties (such as prefix) to the column options that I can reference when adding the footer.
This method gets called in the resize event:
const addTotalRowToDataGrid = async evt => {
const target = evt.target;
// Wait for element to be available via mutationObserver in waitForElement
const dataGridContainer = await waitForElement(`#${target.parentElement.id} .highcharts-datagrid-container`);
// Remove existing footer if present
dataGridContainer.querySelector('.highcharts-datagrid-footer-container')?.remove();
const dataGridHeader = dataGridContainer.querySelector('.highcharts-datagrid-header-container'),
data = target.connector.options.data,
columnNames = target.connector.options.columnNames,
columnOpts = target.options.dataGridOptions.columns,
dataGridFooter = dataGridHeader.cloneNode(true),
footerCols = dataGridFooter.querySelectorAll('.highcharts-datagrid-column-header');
dataGridFooter.classList.add('highcharts-datagrid-footer-container');
for (let i = 0, iLen = footerCols.length; i < iLen; i++) {
const col = footerCols[i];
if (i === 0) {
// Add text to first/header column
col.innerText = 'Total';
} else {
const prefix = columnOpts[columnNames[i]]?.prefix;
col.innerText =
(prefix || '') +
formatNumber(
data
.map(c => c[i])
.reduce((acc, cur) => {
return (acc || 0) + (cur || 0);
})
);
}
}
dataGridContainer.appendChild(dataGridFooter);
}
I hope this illustrates what I mean by this enhancement and helps someone currently in a similar scenario.
from highcharts.
Related Issues (20)
- MouseWheel with Ordinal brake HOT 1
- Remove column aliases from DataTable
- Organization chart: Need a feature to accept the onClick event for customized node UI element HOT 1
- Multiple-point solidgauge is off-center when on 100% HOT 1
- Cannot select a line drawn using Stock Tools. HOT 3
- Donut Chart: Issue with Data plotting HOT 2
- Mapline is hidden when drawing from LA to taiwan HOT 2
- Error 1015 shows HOT 1
- Deleted annotation is present in exported image HOT 3
- Infinite chart resize (reflow) HOT 1
- Color Contrast Ratio for the text 'Month-year' in graph is 1.917:1 which is less than expected (4.5:1) HOT 3
- `headerFormat` use `{point.point.name}` syntax but `pointFormat` use `{point.name}` syntax HOT 1
- chart.getAxes() is poorly named HOT 3
- Adding a yAxis id to the navigator causes plot bands added to the main graph to also display on the navigator. HOT 1
- Improve responsiveness for plot band labels HOT 1
- Drag does not work correctly HOT 1
- Numbers on axis labels HOT 5
- Gantt subtasks with point dependencies getting disorganized when toggling legend HOT 1
- Declaring mouseEvent callback as point event breaks drilldown
- I'm trying to find a way to center my flag but can't seem to do it HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from highcharts.