Home

Awesome

<p align="center"> <img src="https://github.com/oguzhaninan/vue-histogram-slider/raw/master/resources/header.png" width="500"> </p> <p align="center"> Range slider with histogram for <a href="http://vuejs.org/" rel="nofollow" class="rich-diff-level-one">Vue</a> </p> <p align="center"> <img src="https://img.shields.io/github/license/oguzhaninan/vue-histogram-slider?style=flat-square" /> <img alt="npm" src="https://img.shields.io/npm/dm/vue-histogram-slider?style=flat-square"> <img alt="GitHub issues" src="https://img.shields.io/github/issues/oguzhaninan/vue-histogram-slider?style=flat-square"> <img alt="npm" src="https://img.shields.io/npm/v/vue-histogram-slider?style=flat-square"> </p> <hr>

🚀 Quick Start

If you are a try and learn developer, you can start trying the vue-histogram-slider now using codesandbox.io.

<a href="https://codesandbox.io/s/vue-histogram-slider-b7m0e?fontsize=14" target="_blank"> <img alt="Edit Vue Histogram Slider" src="https://codesandbox.io/static/img/play-codesandbox.svg"> </a> <p align="center"> <img src="https://github.com/oguzhaninan/vue-histogram-slider/raw/master/resources/histogram-slider-demo.gif"> </p>

📦 Installation

yarn

yarn add vue-histogram-slider

npm

npm i vue-histogram-slider

🔧 Usage

import Vue from 'vue';
import HistogramSlider from 'vue-histogram-slider';
import 'vue-histogram-slider/dist/histogram-slider.css';

Vue.component(HistogramSlider.name, HistogramSlider);
<HistogramSlider
    :width="600"
    :bar-height="100"
    :data="data"
/>

📋 Props

PropertyTypeDefaultDescription
minnumber1Set slider minimum value
maxnumber100Set slider maximum value
dataarray-Data for histogram
blockbooleanfalseLocks slider and makes it inactive
gridbooleantrueEnables grid of values.
gridNumnumber4Number of grid units.
stepnumber1Set sliders step. Always > 0. Could be fractional.
hideMinMaxbooleantrueHides min and max labels
hideFromTobooleanfalseHides from and to labels
toFixedbooleanfalseFix position of right handle.
fromFixedbooleanfalseFix position of left (or single) handle.
forceEdgesbooleanfalseSlider will be always inside it's container.
dragIntervalbooleanfalseAllow user to drag whole range. Only in double type
keyboardbooleantrueActivates keyboard controls. Move left: ←, ↓, A, S. Move right: →, ↑, W, D.
typestringdoubleChoose slider type, could be single - for one handle, or double for two handles
widthnumber600width of dialog
barHeightnumber100Set max histogram bar height
barWidthnumber6Set histogram bar width
barGapnumber5Set histogram bar gap
barRadiusnumber4Set histogram bar radius
prettifyfunctionnullSet up your own prettify function. Can be anything. For example, you can set up unix time as slider values and than transform them to cool looking dates.
lineHeightnumber6Set slider line height
transitionDurationnumber100Set duration to histogram bars
primaryColorstring#0091ffPrimary color
labelColorstring#0091ffLabel color
holderColorstring#dee4ecHolder color
handleColorstring#ffffffSlider handle color
gridTextColorstringsilverPrimary color
fontFamilystring'Arial, sans-serif'Set text font family
fontSizenumber12Set text font size
handleSizenumber26Slider handle size
histSliderGapnumber6Set gap between slider and histogram
updateColorOnChangebooleantrueUpdate histogram bar color on change (recommended false for performance)

🔧 Event

NameDescription
startTriggers when slider start.
changeTriggers when each values change.
updateTriggers when slider is modified by external methods update or reset.
finishTriggers when user releases handle.