This toolbox contains the MATLAB code for the technical article "Creating Specialized Charts with MATLAB Object-Oriented Programming". These examples were developed by Ken Deeley, David Sampson, Michele Facchinelli, Davide Fantin and Bruno Rodriguez Esteban at MathWorks. This File Exchange entry contains all code and examples used in the article.
A chart provides a task-specific application programming interface (API) for creating custom visualizations. Designing and implementing a chart not only provides a convenient API for end users, but simultaneously removes the need for the user to manipulate low-level graphics objects.
The code comprises several examples of custom MATLAB charts, together with a catalog app for browsing the available charts.
You can inspect the source code used for each chart, explore the features and functionality of each chart, and run Live Script examples demonstrating the use of each chart. The app features several diverse examples of custom charts, together with documentation and resources to help you get started with developing your own charts.
Ken Deeley (2020). Creating Specialized Charts with MATLAB OOP (https://www.mathworks.com/matlabcentral/fileexchange/65857-creating-specialized-charts-with-matlab-oop), MATLAB Central File Exchange. Retrieved .
Well-spotted, thanks for providing the feedback. I have submitted a corrected version which should appear shortly.
The bug in the chart icons still remains. If not all necessary toolboxes are installed some charts are removed from the ChartCatalog (e.g. "Financial Toolbox"). In that case the initialization of the chart icons get messed. To fix this bug I changed the following two lines in the CatalogLauncher class:<br>
line 123: [chartList, ~, indexChart] = intersect( userAccessibleCharts, chartNames );
line 142: "ImageSource", S.ChartTiles(indexChart(k)).Tile, ...
I like the idea of the ChartCatalog and the creation of the documentation as mlx-files including the links to Open the Live script or to view the source code.
I will update the File Exchange entry shortly.
it's clear that you need R2019b for this app but on the file exchange page in MATLAB Release Compatibility the entry is:
Created with R2019b
Compatible with any release
Can you change "Compatible with any release" to at least R2019b.
In the chart catalog the icons on the buttons for the different charts are wrong except for CircularNetFlow Cylinder and EdgeworthBowley. The LineSelector shows the icon of the LineGradient, the Radar shows the icon of the LineSelector, ...
Do you have R2019b installed? The app requires various features from R2019b, including uihtml and the new colororder function referenced in the error message.
when i install your app, i got several errors. Do you know how to solve it?
Error using chartCatalog (line 10)
Invalid default value for property 'DefaultColors' in class 'CatalogLauncher':
Undefined function or variable 'colororder'.
Error in ChartCatalogApp/startApp (line 86)
obj.AppHandle = eval('chartCatalog');
Error in ChartCatalogApp (line 48)
Error in appinstall.internal.runapp>execute (line 116)
out = evalin('caller', [script ';']);
Error in appinstall.internal.runapp>runapp13a (line 95)
outobj = execute(fullfile(appinstalldir, [wrapperfile 'App.m']));
Error in appinstall.internal.runapp>preamble18b (line 60)
appobj = runapp13a(appinstalldir);
Error in appinstall.internal.runapp (line 13)
out = preamble18b(appinstalldir);
Error in matlab.apputil.run (line 45)
Thanks very much for the feedback. Creating a heatmap chart is a great example. You can associate a colormap with an axes as follows.
% Create a figure and an axes.
f1 = figure;
ax = axes(f1);
% Associate a specific colormap to the axes.
% Visualise this by adding a colorbar.
% Next, create a new figure equipped with a different colormap.
f2 = figure('Colormap', summer(64));
% Move the axes to the new figure, then check that the colormaps are preserved.
ax.Parent = f2;
Thank you for this code, it gave me what I needed to get started with some well programmed charts. One comment:
I made a heat-map chart as a way of getting started. I used an Image to present the matrix of numbers and the colormap to set the color representation. However, the colormap is associated with the Figure in Matlab and not an Axes. Consequently, when I change the parent, it take on the colormap of the new figure window. Maybe it would be helpful to make the "parent" property observable, so if it changes I can trigger an "update". It is, however, also possible that I missed something.
Thank you for providing feedback. Further updates to this File Exchange entry are planned. I would be interested to investigate items (1)-(3) with you in more detail. Please email me at <first name> dot <last name> at mathworks dot com with a brief description of the reproduction steps. (4) is fixed for the next release. (5) is a good idea if we release this entry as a toolbox at some point.
A nice ambitious project. It would make me happy to think that this "Chart" object would be continued to be developed.
I have some small issues:
1. The detection of the "GUI Layout Toolbox" does not necessarily work (for me) even though it is installed.
2. The GalleryLauncher misaligns the chart with the image associated with that chart
3. Do you really want to pollute the users name space with your +Data and +Exercise packages (?)
4. Cylinder.mlx contains a saved error
5. Should (or can) this project have the proper MATLAB toolbox parts: help, contents file etc.
Requires GUI Layout Toolbox: https://www.mathworks.com/matlabcentral/fileexchange/47982-gui-layout-toolbox
Fixed bug with incorrect chart icons displaying when not all MathWorks toolboxes are available.
Repackaged as a toolbox.
This update contains further examples of custom charts, and the catalog now has an integral browser for the chart documentation.
Inspired by: GUI Layout Toolbox