Charts and graphs
Last updated
Last updated
Charts and graphs are visual representations of data that are used to simplify complex information and make it easier to understand. They can help highlight key insights and provide a quick summary of data that would otherwise be difficult to interpret. Charts and graphs come in different forms, such as bar graphs, line graphs, pie charts, scatter plots, and more, each suited for different types of data and analytical purposes.
PocketBlocks allows you to insert multiple forms of charts and graphs into your apps to satisfy your needs in different use cases.
In UI mode, the Chart component supports presenting data stored as an array of JS objects. Each object field corresponds to a column in tabular format. The objects in the following array contain three fields: date
, fruit
, and count
.
You can also use JS code in {{}}
to reference data from other components or queries, or to transform data to meet specific needs.
For example, the query result of query1
is as follows.
You can transform it using transformer transformer1
with the following JS code.
Then reference the value of the transformer {{transformer1.value}}
as the data for the chart.
PocketBlocks supports four types of charts: bar chart, line chart, scatter chart, and pie chart. You can select the chart type in Properties > Data > Chart type. You can also customize the layout and style of your chart in Properties tab.
Bar charts, line charts, and pie charts map values to categorical variables. Thus, in such charts, the X-axis usually shows non-numeric data—for example, date or department.
By default, PocketBlocks automatically detects the X-axis data and its type. You can also manually select one among "Category axis", "Value axis", "Time axis", or "Log axis". For detailed information, see X axis type.
In most types of charts, the Chart series (Y-axis) presents numeric values for the categories on X-axis. By default, PocketBlocks populates all numeric fields to Y-axis. You can hide unnecessary fields in Properties > Chart series.
Apart from the built-in charts and graphs, you can also plot your data with Apache ECharts, an open-source JS visualization library. You only need to complete the Configuration > Option field in JSON format. For detailed information, see ECharts docs and ECharts examples.
If you need more configuration options for charts, create a issue on Github.