Canvas tutorialedit

To get up and running with Canvas, use the following tutorial where you’ll create a display for monitoring sales at an eCommerce store.

Before you beginedit

For this tutorial, you’ll need to add the Sample eCommerce orders data.

Create and personalize your workpadedit

Your first step to working with Canvas is to create a workpad.

  1. Open Canvas.
  2. Click Create workpad.
  3. To add a Name for your workpad, use the editor on the right. For example, My Canvas Workpad.

Customize your workpad with imagesedit

To customize your workpad to look the way you want, add your own images.

  1. Click Add element, then click Image.

    The default Elastic logo image appears on your page.

  2. To replace the Elastic logo with your own image, select the image, then use the editor on the right.
  3. To move the image, click and drag it to your preferred location.
images/canvas-image-element.png

You’ll notice that the image is tagged as an asset, which allows you to reuse the image from Manage assets.

Customize your data with metricsedit

Customize your data by connecting it to the Sample eCommerce orders data.

  1. Click Add element, then click Metric.

    By default, the Metric element is connected to a demo data source, which enables you to experiment with the element before you connect it to your own data source.

  2. To connect the element to your own data source, make sure that the element is selected, then click Data.

    1. Click Change your data source, then click Elasticsearch SQL.
    2. In the Elasticsearch SQL query field, enter the following query:

      SELECT sum(taxless_total_price) AS sum_total_price FROM "kibana_sample_data_ecommerce"

      The query selects the total price field and sets it to the sum_total_price field. These fields are pulled from the kibana_sample_data_ecommerce index that you installed.

    3. To verify that the data is correct, click Preview. If you like what you see, click Save.

      At this point, the element displays an error.

  3. Specify how to process and display the data.

    1. Click Display
    2. Under Number, select Value from the function drop-down list, then select sum_total_price from the column drop-down list.
    3. Change the Label to Total sales.

      You’ll notice that the error is gone, but the number could use some formatting.

  4. To format the number, use the Canvas expression language.

    1. In the lower right corner, click Expression editor.

      You’re now looking at the raw data syntax that Canvas uses to display the element.

    2. Look for math "sum_total_price", then add | formatNumber "$0a".
    3. To update the number, click Run.
images/canvas-metric-element.png

Show off your data with chartsedit

To show what your data can do, add charts, graphs, progress monitors, and more to your workpad.

  1. Click Add element, then click Area chart.
  2. To connect the element to your own data source, make sure that the element is selected, then click Data.

    1. Click Change your data source, then click Elasticsearch SQL.
    2. To obtain the taxless total price by date, enter the following into the Elasticsearch SQL query field:

      SELECT order_date, taxless_total_price FROM "kibana_sample_data_ecommerce" ORDER BY order_date

      Although you used the Elasticsearch SQL data source for the metric and area chart elements, each element can display a different data source. Pages and workpads often contain multiple data sources.

    3. To verify that the data is correct, click Preview. If you like what you see, click Save.
  3. Specify how to display the data.

    1. Click Display
    2. From the X-axis drop-down lists, select Value, then select order_date.
    3. From the Y-axis drop-down lists, select Value, then select taxless_total_price.
images/canvas-chart-element.png

Show how your data changes over timeedit

To focus your data on a specific time range, add a time filter to your workpad.

  1. Click Add element, then click Time filter.
  2. Specify how to display the data.

    1. Click Display
    2. To use the date time field from the sample data, enter order_date in the Column field, then click Set.
images/canvas-timefilter-element.png

To see how the data changes, set the time filter to Last 7 days. As you change the time filter options, the metrics dynamically update.

Your workpad is now complete! Use the icons in the upper left corner to:

  • Display your workpad in fullscreen mode
  • Download your workpad as a PDF report or JSON object
  • Configure the refresh rate for your data
  • Share your workpad

Next stepsedit

Now that you know the Canvas basics, you’re ready to explore on your own.

Here are some things to try: