Custom Bar/Column Chart Plugin (Show Totals, Sort Categories, Sort Breakbys)
Steps to install (Current Version is V2.9.0):
- Download from my GitHub
- Download a ZIP of the project, Unzip the folder customBarColumnChart-master, add it to your plugin folder, and rename the folder customBarColumnChart
Description:
When you add a breakby to a bar or column chart, you lose the ability to see the total value for the bar/column, you lose the ability to sort the category based on the total amount in each bar/column, and you never had the ability to sort the breakby. This plugin allows you to do all 3 in an easy to use way. In addition, you can also sort a column/bar chart in any custom predefined configuration.
Example Usage:
- Put plugin in /plugins folder and make sure the folder is called: customBarColumnChart
- Create/Edit column/bar chart
- Activate "CUSTOMIZE CHART" option on the Design Panel.
- Play around with a few options
- EASY SUCCESS! =D
Here you can see the new menu option in the bottom right of the screen outlined in red:
I easily turned on the CUSTOMIZE CHART option, and decided that this chart would be more useful if I could show totals for each column, sort the categories descending, and sort inside the breakby so that the most recent dates are at the top of the column instead of at the bottom.
You can easily click between the various options to see what works best for your usecase! It works on both Column Charts + Bar Charts, and you can play around with all 3 Types (Classic, Stacked, Stack 100). This also supports slice/highlight filtering, drilling, jumping, and even PDF reporting.
Here is another chart that demonstrates a non-stacked bar chart:
In this second example, you can see how the categories are sorted ascending based on the total bar value, as well as how the breakby is now sorted from largest to smallest based on the totals. You can see breakby (legend) is in the same order as the category sorting on the above chart (Bikes was the largest total, Cables & Housing was the smallest total).
Did I mention it supports Column/Bar charts that have multiple series but no breakby as well!
You can even configure your own custom sorts:
This bar chart now has the categories sorted where the countries starting with M and N are at the top. The breakby can be sorted the same way. All you have to do is drag and drop items based on your liking. As soon as you click off to the side of the popup or click Save, the configuration will save. If you don't like the updates you made, just click cancel. If you ever want to you can reset the configuration as well.
There is also functionality to configure the Show Totals:
Here is the widget script for the left chart:
widget.on('processresult', function(w, args) {
//args.widget.custom.barcolumnchart.totalLabelEnabled = false;
args.widget.custom.barcolumnchart.totalSeriesName = 'Total (YOU CAN NAME THIS SERIES)';
args.widget.custom.barcolumnchart.totalPointColor = 'green';
args.widget.custom.barcolumnchart.totalPointFontSize = '20px';
args.widget.custom.barcolumnchart.totalPointSize = '7';
args.widget.custom.barcolumnchart.totalAsLine = true;
args.widget.custom.barcolumnchart.totalPointFontFamily = 'Times New Roman';
args.widget.custom.barcolumnchart.totalYAxisPercentSpacing = 100;
args.widget.custom.barcolumnchart.totalLabelPadding = 100;
});
Here is the widget script for the right chart:
widget.on('processresult', function(w, args) {
args.widget.custom.barcolumnchart.totalPointColor = '#19b9c9';
args.widget.custom.barcolumnchart.totalPointFontSize = '13px';
args.widget.custom.barcolumnchart.totalPointSize = '0';
args.widget.custom.barcolumnchart.totalAsLine = false;
args.widget.custom.barcolumnchart.totalPointFontFamily = 'Times New Roman';
});
Also supports various chart types:
Overall this plugin should be a huge nice to have for most! I hope you enjoy and I’d love to get your feedback! =D
Special Thanks to Artem Yevtushenko for his sorting breakby script. Very big thank you to Jason Sears for teaching me how to make the plugin more responsive and PDFable. Very big thank you to Shani Adani for showing me how to make the plugin responsive even when you change the chart types, and for helping me clean up the code.
-
Hey Brian,
It's a good idea and I've had a few people ask me already. Based on initial investigations it didn't seem possible, as Highcharts officially said they don't support such a feature, but after more investigation this morning, it looks like someone was able to override some of the highchart rendering functions to accomplish it. I am not sure if I can access/override these settings in Sisense though. So let me play around and I'll let you know if possible.
Best,
Elliott
-
V2.8.2 just dropped over the weekend!
Fixed the BreakBy Asc/Desc per Category Sort with negative values. When there are negative numbers, both stacked charts are a bit confusing...expected behavior is debateable.
I noticed that there can be an issue with showing totals when there are negative numbers in a column/bar as well, so currently working on fixing that.
Hope you enjoy! =D
-
Hey Elliott,
Great work. This should go into the product. Addresses a lot of needs.
I just upgraded to v7.3.0.12008 this morning and I'm not seeing the Option Toggle for it in the Design Panel. So far I've tried:
- clearing caches and incognito mode in browser
- disabling and reenabling plugins
- pulling all the plugins out of the plugin folder and restoring them
- IISReset
- rebooting the serverIs is not working in v7.3? If so, is there anything else I should try?
Regards, Jim
-
Hey Jim,
I just tested on v7.3.0.12008 and it works exactly as expected (I upgraded my environment this morning).
You could also try restarting the Sisense.Plugins service in the task manager. Also is the plugin named correctly? Maybe when you re-added the plugins the customBarColumnChart was renamed (does it have a -master at the end of the folder? The folder needs to be called customBarColumnChart).
Let me know if it still doesn't work.
Best, Elliott
-
Elliott,
I restarted the Plugin service and checked the folder name. The plugin is enabled. I created a new column chart, but the Customize menu still doesn't appear. This is on a customer's system running v 7.2.1.10226. This is working for me on another customer's system running v7.2. It must be something I'm doing or not doing. Any ideas?
Regards, Elliott
-
Hey Jim,
Thank you for pointing this out! I just upgraded to V7.4 today and noticed the same. It'll take me a bit to investigate, but will try to update soon. It's interesting because this was working in previous versions, so it could be a conflict with a different plugin.
Best, Elliott
-
Hey Guys,
I'm gonna be investigating this further this week. Will update once I have an update. For some of this, it might be out of my control, so I'll try my best to fix what's not working, and give a timeline for other features that might not be working. Might need to wait for a future version of Sisense after syncing with R&D.
Best, Elliott
-
Hey Guys,
After further investigation yesterday I understand why most of the sort breakby options aren't working in V7.4.0 to V7.4.2. The main reason is that some of the functionality that this plugin provides is making its way officially into the product in some of these most recent versions. Because of this push, some features have changed a little. As an example, breakby's are supposed to be sorted by a field called sortData, but unfortunately this is not the case in 7.4, and they seem to be sorted based on just the name of the field. I am actively working with R&D who made this change, so I suspect I'll have a fix for V7.4.3 or V7.4.4. Once that is tested and fixed I'll see what's going on with the PDF Export as well.
By the way, minor releases are supposed to be every 3-4 weeks going forward. So hopefully this shouldn't take too much time.
Best, Elliott
-
Hey Guys,
After further testing of the PDF export, I realized that everything is actually working correctly in the PDF export. There is another plugin that is conflicting with the PDF export, and was causing it not to work in my V7.4.2 environment. I disabled most of my plugins, and now everything works amazing in the PDF again:
If PDF export isn't working for you, I'd recommend turning of plugins until it works, and then let us know which plugin is breaking the PDF Export. I remember there was issues with older versions of the JAQline plugin.
Best, Elliott
-
I can confirm that the custom sorting (of the data) is now functioning as a custom break-by; my next question is how to get the legend to follow the same ordering. Case and point, I have break-bys done as %-ile buckets, namely (0, 0-25, 25-50, 50-75, 75-100, 100). While I can now sort the data points so that the bar chart orders them correctly, the legend is still out of whack with an order of 100, 0,50-75, 75-100, 0-25 (which I assume is the natural order the elasticube calculates. Without having to change the plugin itself, do you know offhand what the variable names are so I can just script a sort function (unless you are up for adding "sort the legends" feature).
-
Hey Sven,
This part of the plugin was also working back in V7.3. There is a new variable that R&D is using for the labels that is called a legendIndex (this dictates the sort order of the labels in the legend as well). I need to also add the legendIndex concept into my plugin as well.
Give me a few days and hopefully I'll release a new version that fixes this.
Best, Elliott
-
Hey Elliott,
Great to meet you at the Masters Class. I downloaded your latest and will test.
One comment: I wasn't able to find this plugin on the Plugins list page: https://support.sisense.com/hc/en-us/articles/115009313608-Sisense-Plugins-List
My apologies if I just overlooked it somehow.
Regards, Jim
-
Hey Jim,
Pleasure teaching you at Masters! Sorry you weren't able to find the plugin on the plugin list page. I just realized that my 3 most recent plugins are not on that list. I have reached out to a my colleague that is managing that page, and those should be added shortly. Thank you for letting us know!
Best, Elliott
-
Hi Elliott,
First of all this a very helpful plugin you have created.
I had a requirement where the Viewer wants to custom sort the Categories in a column chart, but this plugin only works for the Design mode (which is accessible only by the designer/owner). Can the functionality of the custom sort option be extended to the viewers as well?
Regards,
Pratik
Please sign in to leave a comment.
Comments
104 comments