ForgeComponents
en

Components

j-LineChart

jComponent 20 · jcomponent@20 component Example loaded with jComponent 20

Please review an example and keep a data-source.


Configuration:

  • offsetX {Number} An offset X for value tooltip (default: 10)
  • offsetY {Number} An offset Y for value tooltip (default: 10)
  • templateX {String} Tangular template for X axis (default: {{ value }})
  • templateY {String} Tangular template for Y axis (default: {{ value | format(0) }})
  • selected {String} Tangular template for selected values (default: {{ value | format(0) }})
  • height {Number/String} height (default: 0 = auto-height) or string is meant as a parent element
  • width {Number/String} width (default: 0 = auto-width) or string is meant as a parent element
  • limit {Number} a maximum limit of value for Y axis (default: 0)
  • fill {Boolean} enables filling (default: false)
  • fillopacity {Number} filling opacity (default: 0.1)
  • point {Number} size of point (default: 5)
  • pl {Number} lines left padding (default: 10)
  • pr {Number} lines right padding (default: 10)
  • pt {Number} lines top padding (default: 10)
  • pb {Number} lines bottom padding (default: 25)
  • type {String} lines type, can be normal, curves or step (default: normal)
  • prselected {Number} right padding for selected value (default: 0)
  • avg {Number} average value (chart renders a new black line)
  • xmod {Number} performs modulo for points on x-axis (default: 0)
  • yaxis {nubmer} a count of y-axis points (default: 4)
  • exec {String} a path to function and it's executed after some point is hovered
  • marginW {Number} a margin for width
  • marginH {Number} a margin for height

Good to know:

The templateX, templateY and selected config options can be defined without the use of the {{ and }} brackets. The component appends them automatically.

Use it with <ui-component name="linechart">. When the component is not loaded yet, jComponent downloads it on first use from the address in DEF.fallback (the Componentator CDN by default). Author: Peter Širka. Source: the Componentator components repository, MIT license.

example.html
<div class="container">
	<div class="row">
		<div class="col-sm-6">
			<ui-component name="linechart" path="values"></ui-component>
			<br />
		</div>
		<div class="col-sm-6">
			<ui-component name="linechart" path="values" config="fill:true"></ui-component>
		</div>
	</div>
</div>

<script>
	var values = [];

	values.push({
		name: 'Apples',
		values: [{ x: 2009, y: 100 }, { x: 2010, y: 120 }, { x: 2011, y: 130 }, { x: 2012, y: 150 }, { x: 2013, y: 50 }, { x: 2014, y: 200 }, { x: 2015, y: 80 }, { x: 2016, y: 170 }, { x: 2017, y: 300 }]
	});

	values.push({
		name: 'Oranges',
		values: [{ x: 2009, y: 40 }, { x: 2010, y: 80 }, { x: 2011, y: 400 }, { x: 2012, y: 170 }, { x: 2013, y: 90 }, { x: 2014, y: 60 }, { x: 2015, y: 160 }, { x: 2016, y: 120 }, { x: 2017, y: 180 }]
	});

	values.push({
		name: 'Bananas',
		values: [{ x: 2009, y: 80 }, { x: 2010, y: 40 }, { x: 2011, y: 300 }, { x: 2012, y: 200 }, { x: 2013, y: 120 }, { x: 2014, y: 150 }, { x: 2015, y: 220 }, { x: 2016, y: 40 }, { x: 2017, y: 80 }]
	});
</script>