Developing Dashboards on Vue.js for Bitrix24
The built-in analytics of Bitrix24 covers standard scenarios: sales funnel, manager reports, plan vs. actual. As soon as a business analyst arrives with a request like "show conversion by source broken down by region for an arbitrary period with a filter by responsible person" — standard reports fall short. A Vue.js dashboard is a custom analytics interface embedded in Bitrix24 as an iframe application with direct access to the REST API.
Dashboard Architecture
A dashboard consists of three layers:
- Data layer — requests to the Bitrix24 REST API, caching, aggregation
- Store layer — Pinia stores with reactive computed properties
- Presentation layer — Vue components with Chart.js or ApexCharts
For heavy aggregations — an intermediate server layer (Node.js/PHP) that consolidates data from multiple REST calls and returns ready-made JSON.
Batch Data Collection
The Bitrix24 REST API has a limit of 50 items per request. Retrieving all deals for a period requires pagination or using callBatch:
// composables/useCrmData.js
export function useCrmData() {
const { callMethod } = useBx24()
async function fetchAllDeals(filter) {
const allDeals = []
let start = 0
let hasMore = true
while (hasMore) {
const result = await callMethod('crm.deal.list', {
select: ['ID', 'TITLE', 'STAGE_ID', 'OPPORTUNITY', 'SOURCE_ID',
'ASSIGNED_BY_ID', 'DATE_CREATE', 'UF_CRM_REGION'],
filter,
order: { ID: 'ASC' },
start,
})
allDeals.push(...result)
hasMore = result.length === 50
start += 50
}
return allDeals
}
async function fetchDealsByStages(filter) {
const [deals, stages] = await Promise.all([
fetchAllDeals(filter),
callMethod('crm.status.list', {
filter: { ENTITY_ID: 'DEAL_STAGE' }
})
])
return { deals, stages }
}
return { fetchAllDeals, fetchDealsByStages }
}
Date Range Filter Component
<!-- components/DateRangeFilter.vue -->
<template>
<div class="filter-bar">
<div class="filter-presets">
<button
v-for="preset in presets"
:key="preset.id"
:class="{ active: activePreset === preset.id }"
@click="applyPreset(preset)"
>{{ preset.label }}</button>
</div>
<div class="filter-custom">
<input type="date" v-model="dateFrom" @change="emitCustomRange" />
<input type="date" v-model="dateTo" @change="emitCustomRange" />
</div>
</div>
</template>
<script setup>
import { ref } from 'vue'
import { startOfMonth, endOfMonth, subMonths, format } from 'date-fns'
const emit = defineEmits(['change'])
const activePreset = ref('current_month')
const dateFrom = ref('')
const dateTo = ref('')
const presets = [
{ id: 'current_month', label: 'Current Month' },
{ id: 'prev_month', label: 'Previous Month' },
{ id: 'quarter', label: 'Quarter' },
{ id: 'year', label: 'Year' },
]
function applyPreset(preset) {
activePreset.value = preset.id
const now = new Date()
let from, to
switch (preset.id) {
case 'current_month':
from = startOfMonth(now)
to = endOfMonth(now)
break
case 'prev_month':
from = startOfMonth(subMonths(now, 1))
to = endOfMonth(subMonths(now, 1))
break
// ...
}
emit('change', {
from: format(from, 'yyyy-MM-dd'),
to: format(to, 'yyyy-MM-dd'),
})
}
</script>
Chart.js Integration
// composables/useChart.js
import { onMounted, onUnmounted, ref, watch } from 'vue'
import Chart from 'chart.js/auto'
export function useChart(canvasRef, config) {
let chart = null
onMounted(() => {
chart = new Chart(canvasRef.value, config.value)
})
watch(config, (newConfig) => {
if (!chart) return
chart.data = newConfig.data
chart.update('active')
}, { deep: true })
onUnmounted(() => chart?.destroy())
}
Sales funnel component:
<template>
<div class="chart-card">
<h3>Sales Funnel</h3>
<canvas ref="canvasRef" height="300"></canvas>
</div>
</template>
<script setup>
import { ref, computed } from 'vue'
import { useDashboardStore } from '@/stores/dashboard'
import { useChart } from '@/composables/useChart'
const store = useDashboardStore()
const canvasRef = ref(null)
const chartConfig = computed(() => ({
type: 'bar',
data: {
labels: store.stages.map(s => s.NAME),
datasets: [{
label: 'Number of Deals',
data: store.stages.map(s => store.dealsByStage[s.STATUS_ID] || 0),
backgroundColor: store.stages.map(s => s.COLOR || '#4a90d9'),
}]
},
options: {
indexAxis: 'y',
responsive: true,
plugins: { legend: { display: false } }
}
}))
useChart(canvasRef, chartConfig)
</script>
KPI Cards
Client-side metric aggregation:
// stores/dashboard.js
const kpis = computed(() => {
const deals = filteredDeals.value
const won = deals.filter(d => d.STAGE_ID === 'WON')
const total = deals.length
return {
totalDeals: total,
wonDeals: won.length,
conversionRate: total ? Math.round((won.length / total) * 100) : 0,
totalRevenue: won.reduce((sum, d) => sum + parseFloat(d.OPPORTUNITY || 0), 0),
avgDealSize: won.length
? won.reduce((sum, d) => sum + parseFloat(d.OPPORTUNITY || 0), 0) / won.length
: 0,
}
})
Data Export
Exporting the dashboard to Excel via xlsx:
import * as XLSX from 'xlsx'
function exportToExcel(data, filename) {
const ws = XLSX.utils.json_to_sheet(data)
const wb = XLSX.utils.book_new()
XLSX.utils.book_append_sheet(wb, ws, 'Report')
XLSX.writeFile(wb, `${filename}.xlsx`)
}
Performance
Dashboards with large data volumes require:
- Server-side aggregation — do not send 10,000 deals to the browser
-
shallowReffor large arrays in Pinia — deep reactivity on every object is unnecessary - Table virtualization —
@tanstack/vue-virtualfor lists with more than 500 rows - Debounce on filters — 300–500 ms before making a request
Timeline
A dashboard with 3–5 widgets (funnel, KPI cards, period dynamics) — 5–8 business days. An analytics portal with a dozen widgets, server-side aggregation, export, and access roles — 3–5 weeks.







