score:5
hi this can be a alternate way by the way your goal is not fully achieved but i am giving you some ideas how you can achieve i have used cookies for implementing this one
your head should be looks like
<head>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="scripts/jquery.cookies.2.2.0.js" type="text/javascript"></script>
<meta charset="utf-8">
<title>js bin</title>
</head>
this is your html
<table id="datatable" style="float:left;">
<thead>
<tr>
<th>x axis</th>
<th>y axis</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
i have not included the points in your table which you will have to do
now this should be your script
<script>
window.onload = function () {
var val;
var cat_array1; var cat_array2;
var data_variables = [0, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1];
/*global window: false */
if ($.cookie("cat_array1")) {
var cookie = unescape($.cookie('cat_array1'))
cat_array1 = cookie.split(',')
var cookie1 = unescape($.cookie('cat_array2'))
cat_array2 = cookie1.split(',')
}
else {
var cat_array1 = ['10%', '20%', '30%', '40%', '50%', '60%', '70%', '80%', '90%', '100%'];
var cat_array2 = ['5%', '10%', '15%', '20%', '25%', '30%', '35%', '40%', '45%', '50%'];
$.cookie("cat_array1", cat_array1.join(','));
$.cookie("cat_array2", cat_array1.join(','));
}
function regenrate() {
options = {
chart: {
renderto: 'container',
animation: false,
events: {
click: function () {
alert('click');
}
}
},
xaxis: {
categories: cat_array1
},
plotoptions: {
series: {
cursor: 'ns-resize',
point: {
events: {
drag: function (e) {
},
drop: function () {
var y_val = highcharts.numberformat(this.y, 2);
var x_val = highcharts.numberformat(this.x, 2);
updater(y_val, x_val);
console.log(options.series[1].data);
},
click: function () { var options = this.options; alert('person who like' + options.name + ' ' + options.personname); }
}
},
stickytracking: true
},
column: {
stacking: 'normal'
}
},
tooltip: {
ydecimals: 2
},
series: [{
name: 'main',
data: data_variables,
draggabley: false,
dashable: true
}, {
name: 'modifier',
data: [0, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1],
draggabley: true
}]
}
function updater(yv, xv) {
//console.log("y :" + yv + ",x: " + xv);
var num = xv.match(/^\d+/);
console.log(num);
options.series[1].data[num] = parseint(options.series[1].data[num].y.tofixed(1));
var chart = new highcharts.chart(options);
$('#b' + num).html(yv);
console.log(yv + ", " + xv);
return false;
}
var chart = new highcharts.chart(options);
var yaxis = chart.xaxis[0];
var onyaxisredraw = function () {
for (var tickpos in yaxis.ticks) {
if (tickpos != '-1') {
var $element = $(yaxis.ticks[tickpos].label.element);
$element.unbind('click');
$element.click(function (e) {
// cat_array1.push(1,parseint(e.toelement.innerhtml.replace('%', '')) + 5 + '%');
var aa = jquery.inarray(e.toelement.innerhtml, cat_array1);
cat_array1.splice(parseint(aa + 1), 0, parseint(e.toelement.innerhtml.replace('%', '')) + 5 + '%');
// options.xaxis = cat_array1;
$.cookie("cat_array1", cat_array1.join(','));
// chart.series[0].setdata(null,true);
// var chart = new highcharts.chart(options);//$('#container').highcharts().xaxis[0].update()
window.location.reload();
// regenrate()
});
}
}
}
onyaxisredraw();
yaxis.redraw(onyaxisredraw);
}
regenrate();
}
</script>
explaination :-
you have requirement that should be clicked between 10% and 20% but i think that could not be achieve although i am not sure :)
but if you click on a 10% then at that array you can add 5 and then can do it i hope you will understand my point
this is alternate way if you click on a 10% in array then 15% will be added to it
ok i hope you will understand my point............
Source: stackoverflow.com
Related Query
- Add Points Using Javascript/Jquery
- Convert hours and minute to millisecond using javascript or jQuery
- How can i add element with attributes to SVG using jquery
- how to add custom class name to tick positioner in Highcharts using javascript
- Highcharts - add points to all series using json
- how to add values from my object to Highchart using Jquery
- How to display the value instead of percentage in a pie chart using jquery Highcharts
- Loading Highcharts via shim using RequireJS and maintaining jQuery dependency
- Why .html() doesn't work with SVG selectors using jquery ?
- How do I dynamically change a data point in Highcharts using JavaScript
- Javascript Highcharts v3.0.5 - How to hide Y Axis Title when using multiple Y Axis
- JavaScript error when using Highcharts
- Optimize JavaScript DrillDown code
- Grouping / counting in javascript using underscore.js
- Loading Highcharts series from XML using jQuery
- Create Density Heatmap Chart using Jquery with array of data
- Add additional data to point using DotNet.Highcharts
- How to add new points to highcharts after plotting the first 'n' points?
- Using PhantomJS to create HighCharts grahps server side for use in PDF creation (PHP) - results in exit code 11 from PHPs exec();
- Query rails database, and update highcharts using Javascript
- JavaScript code inside TypeScript file .ts not working
- create a donut chart using highchart using jquery json object
- How to set values in JavaScript (Highcharts) using PHP
- web interface using jQuery for Java application
- when printing page with highcharts using javascript this.print() width values in css in @media print seem to be ignored
- jQuery Highcharts: change chart type using dropdown list
- How to dynamically update highcharts using jQuery UI sliders
- Add Local HTML and JS file using React Native Webview
- c# WPF Webbrowser with Highchart, Javascript from external source not working "An error has occurred in the script on this page"
- How do i add mouse wheel code in Angular2 highcharts in typescript
More Query from same tag
- Chart using highcharts and Json asp.net MVC
- php to highchart, how to send the right array?
- how to call ajax function to update the Highcharts graph dynamically?
- what means ${demo.css} in example files of highcharts ? That piece of code seems to be literal
- plotBands Makes the plotLines Disappears highchart
- median and standard deviation chart using highcharts
- How to Get Highcharts Sparkline to Show Up On My Page.
- Add custom metadata to highchart series
- Calling Highcharts export to jpeg but the source is https and exporting is http (security warnings issued by browser)
- Highcharts Sparkline in reactjs without Jquery
- Ember component being overwritten instead of repeated
- Example to show/hide data with buttons/checkbox in Highcharts?
- Highstock limit max zoom out
- Highcharts plotting line instead of area
- Is there a way to make highcharts tick lines point inwards rather than outwards
- How to format high charts?
- Highcharts stacked column chart 3 level drilldown from JSON
- Highstock doesn't show chart
- highstocks intraday chart with timestamp and non decimal y axis
- DataLabels in R highcharter cannot be seen after print as png or jpg
- highcharter - where are the already downloaded maps for hcmap() stored on a (shiny) server?
- Export multiple series from highcharts into CSV
- Draw another chart/or series on mouse hover in HighStock
- highchart axis datetime + categories
- Set color of Highcharts series bar based on value
- HighChart- Plot Stacked Bar Chart on Status for Every Minute
- Highcharts : Venn Diagram how to show total and union numbers?
- Highcharts add symbol on tooltip when over 100 or 1000
- How to use the tooltip formatter and still display chart color (like it does by default)?
- Complicated Rails query for reports with missing data