score:1
if i understand correctly, you would like to draw a chart for each different panelcodeui ?
if that's the case, change your code after ajax success with that :
var productions = seriedata.d;
var listpanelcodeui = productions.map(function(p){return p.panelcodeui}).filter(function(item, pos, self) {
return self.indexof(item) == pos;
});
//listpanelcodeui : [21,11,31]
listpanelcodeui.sort();
listpanelcodeui.foreach(function(e){
datamacro = [];
//create a div for each panelcodeui
$("body").append("<div id='barchart" + e + "'></div>");
var divid = "#barchart"+e;
//filter productions for specific panelcodeui
var data = productions.filter(function(p){return p.panelcodeui === e});
data.foreach(function(d){
var yval = d.value;
var xval = d.date;
var x = [xval, yval];
datamacro.push(x);
});
$(function () {
$(divid).highcharts({
...
})
})
}
score:1
that's what you need to parse your data:
charts = [];
$.each(productions.map(function(el) {
return el.panelcodeui;
}).filter(function(el, index, arr) {
return arr.indexof(el) === index;
}), function(index,panelcodeui) {
var serie = productions.filter(function(el) {
return el.panelcodeui === panelcodeui;
});
$.each(serie, function(index, production) {
datamacro.push([production.value, production.date]);
});
drawchart('#barchart' + panelcodeui, 'last five days', datamacro);
});
also i made this helper function to create the charts:
function drawchart(containerid, charttitle, data) {
charts.push(new highchart.chart({
chart: {
type: 'column',
renderto: containerid
},
title: {
text: charttitle
},
subtitle: {
text: ''
},
xaxis: {
type: "datetime",
tickinterval: 24 * 3600 * 1000,
labels: {
rotation: -45,
align: 'right'
},
datetimelabelformats: { // don't display the dummy year
day: '%e. %b',
},
//crosshair: true
},
credits: {
enabled: false
},
yaxis: {
labels: {
enabled: false
},
title: {
text: null
}
},
tooltip: {
formatter: function() {
return highcharts.dateformat('%d/%m/%y', new date(this.x)) + '<br/>' + ' in barrels: ' + this.y;
}
},
plotoptions: {
column: {
pointpadding: 0.2,
borderwidth: 0
},
series: {
pointrange: 24 * 3600 * 1000, // one day
pointinterval: 3600 * 1000
}
},
series: [{
//name: '',
showinlegend: false,
data: data,
datalabels: {
enabled: true,
rotation: -90,
color: '#ffffff',
align: 'right',
format: '{point.y:.1f}', // one decimal
y: 10, // 10 pixels down from the top
style: {
fontsize: '13px',
fontfamily: 'verdana, sans-serif'
}
}
}]
}));
}
Source: stackoverflow.com
Related Query
- Have an issue with JavaScript, AJAX code displaying data
- Highchart not displaying the pie chart with Ajax data
- JSON Data Map Issue with HighCharts + Ajax
- How to have multiple highcharts with different series data in vuejs without repeating code
- Highcharts cloud issue with data source when duplicating chart
- Highcharts data series issue with ajax/json and PHP
- creating highchart with ajax json data
- Load data into Highcharts with Ajax
- Highcharts - Issue with negative values when displaying multiple axes
- Highcharts - Global configuration with common code and unique data & Headings
- Highcharts load data with ajax to populate the tooltip
- Highcharts not displaying series data for graph with multiple Y-axes
- AngularJS for Highcharts with dynamic ajax data
- Highcharts with ajax and json data what am i doing wrong?
- c# WPF Webbrowser with Highchart, Javascript from external source not working "An error has occurred in the script on this page"
- Displaying data ArrayList (EJB + Servlet + JSP(JSTL)) to JavaScript ArrayList
- highcharts Gauge live data with ajax
- passing formatting JavaScript code to HighCharts with JSON
- How can I have both a legend and data labels, with different labels, in Highcharts?
- Issue with JSON data encoded from the server, not able to plot the chart
- How to create pie chart with only 1 series data and have background be a circle
- Issue with Dates - trying to plot MongoDB data in Highcharts via PHP
- Ajax dynamic data with column bar chart
- Updating Highchart Series Data with Formatted AJAX Return
- Highcharts: x axis label issue with a single data point
- Issue with json data mapping with Highcharts
- Highcharts series visibility with csv data source
- Updating data points that have changed on invisble HighCharts series issue
- Issue with highchart data display when parsing JSON data
- Dates not displaying correctly in Highcharts plot with irregular time data
More Query from same tag
- Mixed series type with 'rallychart' component
- Highstock/Highcharts timestamp values
- Links in pie charts for Highcharts.js
- R Shiny Highcharter - Add series without full reload
- Interpolate or use a variable inside a string in javascript
- highchart scatter with 24 hours time on y axis and the day of the transaction on x axis
- Issue with Json file for Highstock
- Highcharts returning error #15
- Chart series point added not sync with X axis
- Highcharts issue when start index is less than 0
- Dynamic values above column + jQuery Highcharts
- Highcharts treemap with colouraxis updating styles
- How to generate discontinuous timeline in highcharts?
- Highcharts problem with xAxis using multiple series
- How to place tooltip above point in highcharts x-range?
- Disable legend hover in Highcharts
- Download pdf from High Charts
- Highcharts tooltip on IE9
- Highcharts area range series change plotting area dynamically
- Stacked Column two values per column
- How to prevent tiny bars on charts in Highcharts
- How to show equally spaced axis for datetime for billing cycle related data on highcharts
- UseHTML=True in legend ignores itemWidth on click
- Highcharts Bubble chart mouseover breaking animation
- Remove padding above bar columns
- How to pass variable values in series:[{data: }] object collection
- Rebuild JSON after $http.get with AngularJS
- BIRT: Custom Highcharts Event Handlers
- Creating depth chart using highcharts and creating bids and asks in such a way that bids and asks are created from center of chart
- Highcharts: How to display multiple tooltips by click in multiple series with shared true