Class

ChartView

kiss.ui.ChartView(config)

The Chart derives from DataComponent.

It's a powerful chart view with the following features:

Constructor

# new ChartView(config)

Its a Custom Web Component. Do not use the constructor directly with the new keyword. Instead, use one of the following methods:

Create the Web Component and call its init method:

const myChartView = document.createElement("a-chartview").init(config)

Or use the shorthand for it:

const myChartView = createChartView({
  id: "my-chartview",
  color: "#00aaee",
  collection: kiss.app.collections["opportunity"],
  chartType: "bar",
  chartValueField: "Amount",
  group: ["Country"]
})

myChartView.render()
Parameters:
Name Type Attributes Description
config object
collection Collection

The data source collection

record object <optional>

Record to persist the view configuration into the db

chartType string <optional>

pie, bar, line...

chartValueField string <optional>

Field used to display the values

color string <optional>

Hexa color code. Ex: #00aaee

showToolbar boolean <optional>

false to hide the toolbar (default = true)

showActions boolean <optional>

false to hide the custom actions menu (default = true)

canSort boolean <optional>

false to hide the sort button (default = true)

canFilter boolean <optional>

false to hide the filter button (default = true)

actions Array.<object> <optional>

Array of menu actions, where each menu entry is: {text: "abc", icon: "fas fa-check", action: function() {}}

width number | string <optional>
height number | string <optional>

View Source client/ui/data/chartview.js, line 34

this

Generated markup

<a-chartview class="a-chartview">
     <div class="chartview-toolbar">
         <!-- Chart view toolbar items -->
     </div>
     <div class="chartview-chart">
         <!-- Embedded chart -->
     </div>
</a-chartview>

Methods

# _getCategoryColor(groupFieldId, columnValue) → {string}

Get the color of a category, if any

Parameters:
Name Type Description
groupFieldId string
columnValue *

View Source client/ui/data/chartview.js, line 890

The color of the category

string

# refresh()

Generic method to refresh / re-render the view

Note: used in dataComponent (parent class) showSearchBar method. This method is invoked to refresh the view after a full-text search has been performed

View Source client/ui/data/chartview.js, line 485

# async setColor(newColor)

Update the chart color (toolbar buttons + modal windows)

Parameters:
Name Type Description
newColor string

View Source client/ui/data/chartview.js, line 494

# showFieldsWindow()

Show the window just under the fields selector button

View Source client/ui/data/chartview.js, line 513

# showFilterWindow()

Show the window just under the filter button

View Source client/ui/data/chartview.js, line 522

# showSetupWindow()

Display the setup window to configure the chart:

  • page 1: choose the chart type
  • page 2: choose the grouping field
  • page 3: choose the value field

View Source client/ui/data/chartview.js, line 158

# showSortWindow()

Show the window just under the sorting button

View Source client/ui/data/chartview.js, line 504

# updateLayout()

Update the chart size (recomputes its width and height functions)

View Source client/ui/data/chartview.js, line 529