Git Product home page Git Product logo

chart.js-rangeslider's Introduction

Hi there πŸ‘‹

I'm a Web/AR/VR/XR developer, working for the University of Southern Queensland (USQ ) in the Office for the Advancement of Learning & Teaching (OALT).

I make interactive and immersive activities that promote learning and engagement for students, helping them get the most from their course, and helping examiners build more meaningful tertiary education experiences.

I also make the reasonable popular GitCDN

✨Open source enthusiast, education evangalist ✨

  • Pull Requests appreciated
  • Issues welcome (well not welcome.. well.. you know what I mean!)

Looking to contact me?

Pronouns: He/Him

chart.js-rangeslider's People

Contributors

lambik avatar schme16 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

Watchers

 avatar  avatar  avatar

chart.js-rangeslider's Issues

Canvas context is not recognized by RangeSlider

I'm trying to use Chart.js-RangeSlider in order to create a chart similar to the one in your examples.
However, I get this error:
Cannot read property 'addClass' of null
at new RangeSliderChart (RangeSlider-all.min.js:14767)

Upon further inspection, I realized that the error occurs in this line of RangeSlider-all.min.js:
return ranger.sliderElement.addClass("range-slider").width(opts.chartCTX.canvas.width),

I am obtaining my canvas context as:
graphicContextLines = $('graphicLines').getContext('2d');

And I am creating my chart using this code:

var options = {responsive: true};

$scope.chartGraphicLines = Chart.Bar(graphicContextLines, {
                                data: $scope.data[1],
                                options: options
     }
);

I'm creating a RangeSlider object using this block of code:

var sliderOpts = {
                            chartData: $scope.data[1],
                            chartOpts: options,
                                chartType: 'Bar', 
                                chartCTX: graphicContextLines, 
                                initial: [3, 10] 
};

rs = new RangeSliderChart(sliderOpts);

I re-checked my code and verified that my canvas context does indeed contain info and thus is not null.
So, the bug might be in RangeSlider-all.min.js.

If I am doing anything wrong, please let me know so I can refactor my code and try again.

Thanks in advance!

chartType only provides a line chart

In the description, it seems to indicate that other chart types are available:
chartType: 'Line', //Which Chart.js chart you want (eg. Lie, Bar, Pie, etc.)

Changing this variable appears to have no affect on the actual chart type. Is this intended?

Slider max range nevers reaches last value

If you look at the code of example JSfiddle: https://jsfiddle.net/schme16/xfyvvup8/ you will notice that the last entry in the X axis is 2020.

However, if you slide the rightmost slider to the right you will see you can never reach the year 2020. It is never shown.
This is also happenning to the example I am building.

If you override the code "initial: [3, 10]" to (for example): initial: [3, 10000] initially the year 2020 will appear but that creates another bug because if you try to slide the rightmost slider to the right it will go off chart.

.noUiSlider.on('change', function () { }) event not working on some devices

Hi,
Im working with this library in one web project, but i have issues on some mobile devices like iPhone 11, iPhone 11 pro and iPhone X. Nevertheless, in iPhone 11 pro max and all desktop works perfectly.

I have a function that is:
this.rangeSliderChart.sliderElement[0].noUiSlider.on('change', () => {
/* do something*/
}

This function do something everytime that the slide handle is moved. I prove with another noUiSlider events but this is not working in more devices that have worked with 'change' event.

Do you know if this is a bug of this library or is it a conflict between devices?

Thanks in advance.

The chart does not appear when using the slider

When creating a chart with a slider, the chart is not displayed in a number of cases until the position of the slider is changed. I think this is due to the creation of two objects of Chart class within the same context (lines 3 and 29 of RangeSlider-core.js):

chartProto: new Chart(opts.chartCTX),
ranger.chart = new Chart(ctx, {

As far as I understand, the first object is created only in order to update width of the corresponding canvas element for the slider element to occupy the corresponding space. If this is the case, then the first Chart is not necessary to create, but instead move line 89 a little back before editing of css:

	ranger._create()

	ranger.sliderElement
		.addClass('range-slider')
		.css({
			width: opts.chartCTX.canvas.width - 50
		})

	//TODO: add rangeslider width adjustment
	$(window).on('resize', function () {
		ranger.sliderElement.css({
			width: opts.chartCTX.canvas.width - 50
		})
	})

	return ranger

In this case width of appropriate canvas element would be properly updated, so the width of the slider element will be the same as it was intended.
no-chart

Can't include in angular2

I have installed through npm.

but when I try to use it through:
import * as RangeSlider from 'chart.js-rangeslider/dist/RangeSlider-minimal.min'

and try

var sliderOpts = {
  chartData: this.chart.config.data, //The same data you give to Chart.js
  chartOpts: this.chart.config.options, //Your Chart.js options
  chartType: this.chart.config.type, //Which Chart.js chart you want (eg. Lie, Bar, Pie, etc.)
  chartCTX: this.ctx, //your canvas context

  class: 'my-chart-ranger', //Specifies a custom class you want applied to your sliders

  initial: [3, 10] //Which data points to start the sliders on
};

let test = new RangeSlider.RangeSliderChart(sliderOpts)

it can't find RangeSliderChart.
Any solution on how to solve this?
Thanks in advance

Problems with tooltip customization after applying range slider

Hello,
Here is my code: https://www.podzielsiehistoria.pl/Chart/ParishStatistics?parishId=1

Everything is ok, when there is no tooltip customization properties declared in the 'option' section. After the declaration of "mode: 'index' " a tooltip doesn't work. The same issue is with every other declaration of the tooltip property. Have somebody an idea what is going on?
The same issue is when you try to customize tooltip here: http://jsfiddle.net/schme16/xfyvvup8/

Another issue is a display problem on mobile devices. Loaded chart is not displayed. When you tap on the screen everything starts to be displayed properly. It must be some kind of refreshing problem.

Will be gratefull for your help,

Jacek

Uncaught TypeError: Converting circular structure to JSON

I am getting this error when I place data into the rangerslider object. I don't know why it's saying it's circular.

Uncaught TypeError: Converting circular structure to JSON RangeSlider-all.min.js:18617
at JSON.stringify ()
at Object._getData (RangeSlider-all.min.js:18617)
at Object._create (RangeSlider-all.min.js:18617)
at new RangeSliderChart (RangeSlider-all.min.js:18617)
at readings.php?start=2018-06-18T09%3A58&end=2018-06-18T09%3A59:157
_getData @ RangeSlider-all.min.js:18617
_create @ RangeSlider-all.min.js:18617
RangeSliderChart @ RangeSlider-all.min.js:18617

npm package

Could you please publish this to the npm packages?

RangeSlided chart size is huge compared to regular

Hi,

When I use the regular new Chart(), my chart has a 'normal' size, but when I use the new RangeSliderChart() with the same chart options, it's a lot taller and spaced out.
What could be the cause?

Best regards,
Tom

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.