oguzhaninan / vue-histogram-slider

Range slider with histogram for Vue.js
https://npmjs.com/package/vue-histogram-slider
MIT License
123 stars 49 forks source link

Data for histogram #2

Closed dinhthang12t closed 5 years ago

dinhthang12t commented 5 years ago

Hi how can i customize data for histogram like: data: [10,5,4,20,100] Thank you

oguzhaninan commented 5 years ago

Hi @dinhthang12t, Example:

<template>
  <div id="app">
    <HistogramSlider
      style="margin: 200px auto"
      :width="600"
      :bar-height="100"
      :data="data"
      :prettify="prettify"
      :drag-interval="true"
      :colors="['#4facfe', '#00f2fe']"
      :min="4"
      :max="100"
    />
  </div>
</template>

<script>
export default {
  data() {
    return {
      data: [10, 5, 4, 20, 100]
    };
  }
};
</script>
jonalxh commented 4 years ago

Hi @oguzhaninan What if the server send me the counted data? Something like this:

[ { value: 5, count: 15}, { value: 250, count: 124}, ... ]

Is there a way to pass the data in this way?

Thanks for your help.

oguzhaninan commented 4 years ago

Hi @jonalxh, There is no structure suitable for this data. You can just take the values ​​and try them out by making a list.

[5, 250,....]

jonalxh commented 4 years ago

Ok, I'll try, thanks.