<template>
<div>
<div id="wrapper">
<div id="chart-line">
<apexchart
type="line"
height="130"
:options="chartOptions"
:series="series"
></apexchart>
</div>
<div id="chart-line2">
<apexchart
type="line"
height="130"
:options="chartOptionsLine2"
:series="seriesLine2"
></apexchart>
</div>
<div id="chart-area">
<apexchart
type="area"
height="130"
:options="chartOptionsArea"
:series="seriesArea"
></apexchart>
</div>
</div>
</div>
</template>
<script>
import VueApexCharts from 'vue-apexcharts'
// The global window.Apex variable below can be used to set common options for all charts on the page
Apex = {
chart: {
height: 130,
},
title: {
style: {
fontSize: '14px',
},
},
dataLabels: {
enabled: false,
},
stroke: {
curve: 'straight',
},
toolbar: {
tools: {
selection: false,
},
},
markers: {
size: 6,
hover: {
size: 10,
},
},
tooltip: {
followCursor: false,
theme: 'dark',
x: {
show: false,
},
marker: {
show: false,
},
y: {
title: {
formatter: function () {
return ''
},
},
},
},
grid: {
clipMarkers: false,
},
yaxis: {
tickAmount: 2,
},
xaxis: {
type: 'datetime',
},
}
// Deterministic daily random walks so every chart shares the same date range
// and the synced crosshair always has data under it.
function mulberry32(seed) {
return function () {
seed |= 0
seed = (seed + 0x6d2b79f5) | 0
var t = Math.imul(seed ^ (seed >>> 15), 1 | seed)
t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t
return ((t ^ (t >>> 14)) >>> 0) / 4294967296
}
}
function dailySeries(seed, count, base, spread) {
var rand = mulberry32(seed)
var series = []
var ts = new Date('01 Jun 2025').getTime()
var val = base
for (var i = 0; i < count; i++) {
val += (rand() - 0.5) * spread
series.push([ts, Math.round(val)])
ts += 86400000
}
return series
}
export default {
components: {
apexchart: VueApexCharts,
},
data: function () {
return {
series: [
{
name: 'Page Views',
data: dailySeries(11, 20, 42, 18),
},
],
chartOptions: {
chart: {
id: 'pageviews',
group: 'website',
type: 'line',
height: 130,
},
title: {
text: 'Page Views (k)',
},
colors: ['#008FFB'],
},
seriesLine2: [
{
name: 'Sessions',
data: dailySeries(23, 20, 20, 8),
},
],
chartOptionsLine2: {
chart: {
id: 'sessions',
group: 'website',
type: 'line',
height: 130,
},
title: {
text: 'Sessions (k)',
},
colors: ['#546E7A'],
},
seriesArea: [
{
name: 'Sign-ups',
data: dailySeries(35, 20, 38, 16),
},
],
chartOptionsArea: {
chart: {
id: 'signups',
group: 'website',
type: 'area',
height: 130,
},
title: {
text: 'Sign-ups',
},
colors: ['#00E396'],
},
}
},
}
</script>
<style>
#wrapper {
padding-top: 20px;
padding-left: 10px;
background: #fff;
border: 1px solid #ddd;
box-shadow: 0 22px 35px -16px rgba(0, 0, 0, 0.1);
max-width: 650px;
margin: 35px auto;
}
</style>