Charts

Simplicite.UI. Charts

new Charts(app, ui)

Description:
  • ChartJS controller

Parameters:
Name Type Description
app Simplicite.Ajax

Ajax service

ui Simplicite.UI.Engine

Main UI controller

Members

COLORS

Description:
  • Current palette of colors
    default: app.sysparams.CHART_PALETTE or 'Sea'

Current palette of colors
default: app.sysparams.CHART_PALETTE or 'Sea'

PALETTE

Description:
  • Current palette name

Current palette name

(constant) PALETTES

Description:
  • Predefined palettes { name:[colors] }.

Predefined palettes { name:[colors] }.

Methods

addTitle(config, title, legend)

Description:
  • Add a title and legend

Parameters:
Name Type Description
config Object

Chart config

title Object

display+text

legend Object

display+position

backgroundColor(config, color)

Description:
  • Set the background color of chart

Parameters:
Name Type Description
config Object

Chart config

color string

background color of canvas

chart(ctn, config, click)

Description:
  • Chart JS

Parameters:
Name Type Description
ctn jQuery

Container

config Object

From chart.js v2/v3 config with options

click function

Optional handler function(chart, clickElements, dataset, elementIndex, datasetIndex)

chartCrosstab()

Description:
  • Chart for crosstab

chartHeapSize(ctn, data, p)

Description:
  • Heap chart of browser memory (LOG_UI=yes)

Parameters:
Name Type Description
ctn jQuery

Container

data Object

Lines data [{d,u,t},...]

p Object

Optional chart.js options

chartServiceSteps()

Description:
  • Steps of front service (LOG_UI=yes)

chartServiceTimes()

Description:
  • Times of front service (LOG_UI=yes)

chartStatusCount(ctn, data, p)

Description:
  • Status count in a chart line per date

Parameters:
Name Type Description
ctn jQuery

Container

data Object

Line data

p Object

Optional chart.js options

chartStatusDuration(ctn, d, p)

Description:
  • Status duration in a polar/radar/bar charts

Parameters:
Name Type Description
ctn jQuery

Container

d Object

Duration data

p Object

Optional chart.js options

chartStatusPie(ctn, data, p)

Description:
  • Status count in a PIE

Parameters:
Name Type Description
ctn jQuery

Container

data Object

Pie data

p Object

Optional chart.js options

chartStatusTerminal(ctn, data, p)

Description:
  • Process duration in a bar chart

Parameters:
Name Type Description
ctn jQuery

Container

data Object

Duration data

p Object

Optional chart.js options

css2rgb(color, alpha)

Description:
  • Convert #RRGGBB to object {r,g,b,a}

Parameters:
Name Type Description
color string

Color #RRGGBB

alpha number

Alpha (transparency)

Returns:

object {r,g,b,a}

css2rgba(color, alpha)

Description:
  • Convert #RRGGBB to string

Parameters:
Name Type Description
color string

Color #RRGGBB

alpha number

Alpha (transparency)

Returns:

string 'rgba(r,g,b,a)'

getBrightColor(darkest)

Description:
  • Get the brightest color in the current palette

Parameters:
Name Type Description
darkest boolean

True to get the darkest one

Returns:

A color #RRGGBB

getColor(i)

Description:
  • Indexed color in palette

Parameters:
Name Type Description
i number

Index

Returns:

color (#RRGGBB)

getColors()

Description:
  • All palette colors

Returns:

array of colors (#RRGGBB)

getPalette()

Description:
  • Current palette

Returns:

palette = list of colors

hsv2rgb(hsv) → {Object}

Description:
  • Convert {h,s,v} to {r,g,b}

Parameters:
Name Type Description
hsv Object

Color {h,s,v}

Returns:

Color {r,g,b}

Type
Object

lightenDarkenColor(color, val)

Description:
  • Get the lighten or darken color

Parameters:
Name Type Description
color string

#RRGGBB

val number

255..255

Returns:

A color #RRGGBB

rgb2css(rgb)

Description:
  • Convert object {r,g,b} to #RRGGBB

Parameters:
Name Type Description
rgb Object

Color {r,g,b}

Returns:

Color #RRGGBB

rgb2hsv(color) → {Object}

Description:
  • Convert {r,g,b} to {h,s,v}

Parameters:
Name Type Description
color Object

Color {r,g,b}

Returns:

Color {h,s,v}

Type
Object

setPalette(name)

Description:
  • Change the current palette

Parameters:
Name Type Description
name string

Palette name ('Sea', 'Base'...)

size(s)

Description:
  • Format octets size to Kb/Mb/Gb/Tb

Parameters:
Name Type Description
s number

Size

stacked(config, stacked)

Description:
  • Set Stacked option

Parameters:
Name Type Description
config Object

Chart config

stacked boolean

true to stack axis