Developing Chart Classes

Author your own class of custom chart objects

Define your own chart class by creating a subclass of the ChartContainer base class. If you write scripts or functions for creating specialized visualizations and share them with others, consider creating a class implementation. Creating a class enables you to provide a convenient interface for your users. When they want to customize aspects of your chart, they can set properties rather than having to modify and rerun your graphics code. You design your own custom set of properties and control which ones your users can access. Users can modify properties at the command line or inspect them in the Property Inspector. Instances of your class are members of the graphics object hierarchy. As a result, your charts are compatible with many aspects of the graphics system. For more information, see Chart Development Overview.

Classes

matlab.graphics.chartcontainer.ChartContainer Base class for developing chart objects
matlab.graphics.chartcontainer.mixin.LegendAdd legend support to chart container subclass
matlab.graphics.chartcontainer.mixin.ColorbarAdd colorbar support to chart container subclass

Methods

expand all

setupSet up instance of chart container subclass
updateUpdate instance of chart container subclass after setting properties
getAxesGet axes for chart container subclass
getLayoutGet tiled chart layout for chart container subclass
getLegendGet legend object for legend mixin subclass
getColorbarGet colorbar object for colorbar mixin subclass

Topics

Chart Development Basics

Chart Development Overview

Learn the basic steps for authoring a class of chart objects.

Develop Charts With Polar Axes, Geographic Axes, or Multiple Axes

Define a class that contains one or more Cartesian, polar, or geographic axes.

Write Constructors for Chart Classes

Customize the calling syntax for creating a chart object.

Managing Properties and Methods

Managing Properties of Chart Classes

Validate property values, optimize how properties update, and customize how properties display for the charts you author.

Enabling Convenience Functions for Setting Axes Properties

Enable the title, xlim, and ylim functions for a class of chart objects.

Saving and Loading Instances of Chart Classes

Develop chart that preserves interactive changes when you save it.

Chart Class with Custom Property Display

Develop a chart object that displays two lines and has a custom property display.

Featured Examples