GithubHelp home page GithubHelp logo

oguzhaninan / vue-histogram-slider Goto Github PK

View Code? Open in Web Editor NEW
120.0 120.0 46.0 1.46 MB

Range slider with histogram for Vue.js

Home Page: https://npmjs.com/package/vue-histogram-slider

License: MIT License

JavaScript 85.63% HTML 0.59% Vue 13.78%
histogram histogram-slider range range-slider slider vue

vue-histogram-slider's People

Contributors

bookwyrm avatar dependabot[bot] avatar florianbruckner avatar nmerm avatar oguzhaninan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

vue-histogram-slider's Issues

Log scale?

Would it be possible to specify a log scale rather than linear scale? Or to expose underlying d3 settings somehow so that I can accomplish that myself?
Thanks!

Problems using component with typescript after v0.3.4

Hi,
Thanks for your work on this component!

I was using vue-histogram-slider successfully at v0.3.4, inside my nuxt app which is using typescript.

If I try to update the version of vue-histogram-slider to v0.3.5 or higher, it produces an error in the browser window: "render function or template not defined in component"

And in the console, npm dev command shows this error:
[Vue warn]: Failed to resolve async component: () => webpack_require.e(/*! import() / 1).then(webpack_require.bind(null, /! ./.vue */ "./components//.vue"))
Reason: ReferenceError: window is not defined

I think this might be due to this commit, which references "window" on line 161.

I think this trips Nuxt up if it's trying to server-side render, because there is no "window" object in node.
It may be possible to work around this with a plugin such as mentioned here, but I think it would be simpler just to check for window before referencing it?

How can I use histogram-slider using CDN?

Hi, I tried to use CDN histogram-slider in html file but It didn´t work. Is there any example to use like this? I will really appreciate it.

<script src="https://unpkg.com/vue-histogram-slider></script>
<script> Vue.component('HistogramSlider', {template: ' '} );

var slider = new Vue({
el: '#app2',
data() {
return {
data: ["2004-11-23T22:00:00.000Z", "2005-02-28T22:00:00.000Z", "2012-08-09T21:00:00.000Z"].map(d => new Date(d).valueOf()),
prettify: function(ts) {
return new Date(ts).toLocaleDateString('en', {
year: 'numeric',
month: 'short',
day: 'numeric'
})
}
}
}
});
</script>

Using vue-histogram without global registration

The current implementation of vue histogram suggests to register the component globally in the app.
This leads to the components being bundled at places we don't need it.

Also, registering the component locally leads to infinite recursion.

Is there a way we can register the component locally?

Is there any way to make slider's width to 100%?

How can I set sliders' width to 100%?
I have tried to set it like this :width="'100%'" but got a type error cause it was expecting number as a prop.

image

My workaround:
I took a wrapper class and added CSS like this
.rangeSlider .vue-histogram-slider-wrapper { width: 100% !important; }

Is there any better way to do it?

Updating from, to on mount renders partial histogram bars

Steps to reproduce

  1. Update the from and to range of the histogram using the update() method once the histogram is mounted.
  2. Once in a while, refresh the page/re-mount the component.

Observation
The histogram is partially rendered.

I think the canvas is in the midst of painting the graph while an update is triggered.
The extent to which the bars are rendered depends on how quick the component renders. If the component is moderately light, the partial rendering of the histogram is visible as shown:
Screenshot 2021-04-12 at 10 06 55 PM

This is taken from the example histogram provided in the source directory.

A possible workaround is an explicit wait for the rendering of the histogram to complete, would be great if there could be an event raised once the histogram has completed rendering.

Support for v-model

It'd be great if the component would support v-model for the selected values, so that the reactiveness is maintained rather than having to listen to the events being triggered (which is what I assume you have to do at the moment to get the new values?).

Non-passive event listeners destroying performance

I believe vue-histogram-slider is based on another library called histogram-slider. I've tried to implement a fix for this as I think we just need to specify passive in any 'touchstart' event listeners. It looks like both the original library and the Vue wrapper have this issue.

All modern browsers report this for each item you iterate through when adding data to the histogram. It kills performance and there is no way that I can see to simply suppress it.

I have over 400 of these messages in my application each time the positions update which is whenever the user moves a map:

image

If these event listeners were updated to have '{ passive: true }', I believe it would correct the issue. I was thinking maybe @oguzhaninan has this setup where he could pull in the updated library and update each 'touchstart' event listener in 15 minutes. I see that there hasn't been an update in two years though. If I can correct this, should we create a new repository where we can keep an updated version? What do you guys suggest?

@oguzhaninan want to chime in? What do you want to do with this if anything? I think it should be kept alive but maybe it needs to be rewritten for Vue3; is this the reason for abandoning it?

Question: Handle size

Can I make handle size bigger? It's not super fun on mobile, but I think it would be if the handle size could be changed. Is there already a prop for this?

Disable zoom in Histogram

Hey, is it possible to disable the zoom via props so that the scale of the histogram remains fixed?
example

How do you use more than one slider on a single component

It seems that this slider uses IDs and classes that prevent you from having more than one slider present on the same component at the same time.

The result is that any sliders created after the first one end up taking up the same space on the page.

How do you prevent this from happening and use more than one slider per page/component?

Data for histogram

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

Change data

Is there any way to change the histogram data when you click on a button? I have a currency converter and I want to change the values from the data with the new values when I change the currency.

Vue 3 support?

This is an AMAZING package. Would really appreciate it if you could migrate it for Vue 3

Import error

I'm trying to use this library with Vue 2 and Node 16. However, I get the following error when importing the library using this command:

import HistogramSlider from 'vue-histogram-slider'

The error is:

export 'default' (imported as 'HistogramSlider') was not found in 'vue-histogram-slider' (module has no exports)

Any idea why this is happening?

Histogram Not Updating

When passing an array of data to the histogram it doesn't update visually. Inspecting the histogram object does in fact show the data in place.

created() { let locations = this.$store.getters['map/activeLocations'] for (let location in locations) { this.data.push(locations[location].price) }

This pulls my location data and writes it to 'data' which is in a reactive state. Should I be pushing the data into the vue-histogram-slider a different way? I can inspect the histogram object and view the data I just pushed into it, yet the histogram bars do not update.

Showing Column

Is there any way to show tooltip values on the graph?

Support multi-color gradient for color prop

Currently, when I provide an array of colors to the colors prop of VueHistogramSlider, it'll only use the first two colors of any array that I provide.
I was hoping it would use a multi-color gradient using as many colors as I provide.

Is this something that will be supported at all?

Change design

Hi, I've started using your component and it is amazing, I want to know if there is a way to change the design to not show the data as bars but a chart area instead, something like this:

image

Is it possible? If not, Do you have any idea of how to achieve it?

Preselect "from" and "to" displaying the whole data set

For example, if I have a data set that goes from 1 to 100, if I set min to 50 and max to 70, then all the values from 1 to 100 are not displayed when the component is rendered, so I assume that instead of min and max it should be from and to, but I dont see these as options.

Is there an alternative for this?

Histogram doesn't react to data changes

I set the data property to a computed property of the containing component and the slider doesn't update the bars.

If I change the section and then go back to where the slider is used then it updates. It seems that it only gets rendered on mount.

Handle placement is wrong

When setting the grid="false" the placement of the handles are slightly of:
image

When setting it to true it works:
image

Histogram Tooltips

Is it possible to have tooltip on hovering Histogram bars and being able to customize data in that tooltip?

Externally updating gives error this.histSlider.update is not a function

I have got some buttons outside of histogram slider that set the time range on the slider. For example past hour or past day. This used to work and I updated the sliders from property like this:

this.$refs.histogramSlider.update({from: this.sinceTime})

However after an update it started throwing the above error and it's not updating anything. The rest of the slider is working as intended.

Am I updating it wrong?

Considering a less restrictive license.

This component is very great but I can't use it on a commercial single page application without opening source code. Is it wanted ? Or do you have the possibility to change the license ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.