Skip to main content

Charts

Charts (Wisej.Web.Ext.Charts) is the first experiment at bringing Chart.js into Wisej.NET. It bundles Chart.js 1.0.1 and exposes a single Chart control. That control always renders the same bar chart, with seven monthly labels and two data sets of sample values. It has no properties or methods for setting the chart type, labels or data.

Work in progress: not for applications

Charts is an unfinished prototype, and it isn't published on NuGet. It can't display your data. For charts in an application, use ChartJS, ChartJS3 or ChartJS4, which are complete controls with data sets, options, events and image export.

What it's useful for​

The source is a compact illustration of the smallest possible JavaScript-backed control. There are three parts:

  1. A server class. Chart derives from Control and overrides OnWebRender. It sets config.className to the client class to create, then adds the properties that class expects (chartType, data) to the configuration object.
  2. A client class. Platform/Chart.js defines wisej.web.ext.Chart with qx.Class.define. It extends wisej.web.Control, replaces the content element with a canvas, declares chartType, data and options properties, and creates the Chart.js instance when the control first appears.
  3. The library itself, Platform/chart-js.js, embedded in the assembly next to the client class.

That pattern (render the configuration on the server, apply it in a qooxdoo class in the browser) is the one full extensions build on. For the concepts behind it, see JavaScript and JavaScript Object Model in the user guide.

A simpler route: Widget

Most integrations don't need a qooxdoo class of their own. Deriving from Widget and supplying an InitScript and Packages is enough, and it's what ChartJS does. See Widget in the user guide.

Usage​

If you build it from source, the control is used like any other:

var chart = new Wisej.Web.Ext.Charts.Chart
{
Dock = DockStyle.Fill
};
this.Controls.Add(chart);

API reference​