Skip to main content
100%

Roxie Column Chart

✓ Published0🌍 Public
GGordonSmith
Last edited Aug 9, 2018
Created on Jan 29, 2016

This example shows population data for Irish counties in an interactive column chart. A dropdown menu allows selection of male, female, or total population figures. The visualization uses the HPCC Platform's Roxie query service, fetching data via the `Query.attach` and `query.submit` APIs from `@hpcc-js/comms`. The retrieved rows are mapped into a data array and rendered using the `Column` chart component from `@hpcc-js/chart`.

AI-generated description

Tutorial 6: HPCC Platform Roxie Data + Column Chart

Fetching data from a HPCC Platform Roxie Query and rendering it in a Visualization:

1 - Create an empty Column chart and render it:

var columnChart = new Column()
    .target("placeholder")
    .columns(["Location", "male"])
    .yAxisTitle("male")
    .render()
    ;

2 - Attach to an existing Query:

var query = Query.attach({ baseUrl: "https://play.hpccsystems.com:18002" }, "roxie", "ie_pop");

3 - Submit a request to the Roxie service (returns a Promise):

query.submit({
    pop_type: popType  //  male, female, total
}).then(response => {
    ...
});

4 - Map the rows to a data array:

var data = response.ie_population.map(function (row) { return [row.location, row.total]; });

5 - Update the Column chart with the mapped data:

columnChart
    .columns(["Location", popType])
    .yAxisTitle(popType)
    .data(data)
    .render()
    ;
apache-2.0 Licensed

Similar vizzes