ChartForm
- class compas_rhino.forms.ChartForm(*args: Any, **kwargs: Any)[source]
Bases:
System.Windows.Forms.System.Windows.Forms.Form._name
A form for displaying charts.
- Parameters
series (list of dict) – A list of dictionaries with each dictionary defining the attributes of a series. The following attributes are supported:
name: The name of the series.
data: A dictionary with x-y pairs.
color (optional): A hex color or an RGB(255) color specification.
linewidth (optional): The width of the series graph line.
linetype (optional): The visual style of the graph line. Should be one of
{'solid', 'dotted', 'dashed'}
.
xlimits (2-tuple) – Minimum and maximum values on the X-axis.
xstep (int) – Size of the steps along the X-axis.
ylimits (2-tuple, optional) – Minimum and maximum values on the Y-axis. Default is
None
, in which case the limits will be computed from the min/max values of the data in the series.ystep (int, optional) – Size of the steps along the Y-axis. Default is
int((ymax - ymin) / 10.)`
.
- Other Parameters
bgcolor (str, tuple, System.Drawing.Color) – The background color of the chart area.
Examples
import random from compas.utilities import fibonacci from compas_rhino.forms import ChartForm series = [ { 'name' : 'series1', 'color' : (255, 0, 0), 'linewidth' : 1, 'linestyle' : 'dashed', 'data' : dict((str(i), random.randint(30, 70)) for i in range(10)), }, { 'name' : 'series2', 'color' : (0, 255, 0), 'linewidth' : 1, 'linestyle' : 'solid', 'data' : dict((str(i), i ** 2) for i in range(10)), }, { 'name' : 'series3', 'color' : (0, 0, 255), 'linewidth' : 1, 'linestyle' : 'dotted', 'data' : dict((str(i), fibonacci(i)) for i in range(10)), }, ] form = ChartForm(series, (0, 10), 1) form.show()
Methods
init
()on_form_closed
(sender, eargs)show
()Show the form as a modal dialog.