Zingchart - some points are hidden in the graph - javascript

I use Zingchart to plot some log Data therefore I need to display every single point in the graph. I activated the points attribute in the json(see
$scope.graphoptions = {
theme:"dark",
"gui":{
behaviors:[]
},
globals: {
shadow: false,
fontFamily: "Helvetica"
},
type: "line",
plot: {
aspect: "segmented",
marker: {}
},
"legend":{
margin :"5% 88%",
layout: "float",
fontSize : "10px",
backgroundColor: "#888888",
borderColor : "#000000",
shadowColor : "transparent",
toggleAction: "hide",
item: {
markerStyle : "circle",
fontColor: "#ffffff"
},
},
scaleX: {
zooming: true,
item: {
fontColor: "white"
},
guide: {
visible: false
},
"transform": {
"type": "date",
"all": "%G:%i",
}
},
"scaleY": {
zooming:true,
lineColor : "#DDD",
tick : {
lineColor : "#DDD"
},
item : {
fontColor : "#DDD"
},
refLine : {
lineColor : "#DDD"
},
},
tooltip : {
//we have to store the tooltip fkt globally so its ouside angulars
//scope thatswhy we have to pass the data to the function
jsRule : "applyTooltip("+$scope.fileName+")",
shadow:false
},
plotarea: {
"adjust-layout":true,
backgroundColor : '#272822'
},
}
for full json).
As you can see in this screenshot
Some points of the read Graph are drawn but none of the blue one.
When I zoom in:
Some markers of the Blue graph are displayed.
Is this a bug or do I have to activate an other attribute in the json I am not aware of.
Thanks in advance!

Assuming that your data is supposed to plot on those points, then you would need to increase the number of default markers drawn on the plot. By default, ZingChart calculates this number based upon the number of points, and the width of a chart.
maxNodes: N where N is the maximum amount of nodes you want displayed at a given point. e.g. maxNodes: 1000
If tooltips are important at a fine resolution, you would need to also change maxTrackers: N, where N is the amount of nodes to track for a tooltip. Do note that this will decrease performance heavily depending on the number of nodes to track. e.g. maxTrackers: 1000

Related

How To Customize a Flotr2 Radar Chart

http://www.humblesoftware.com/flotr2
I am trying to modify the default font size, weight, and color for the Flotr2 radar chart. I could change this in the flotr2.js file but I want to leave the source file alone.
Currently when I set a larger fontSize in the Flotr.draw call it just spaces out the labels further.
function drawGraph(container, series, ticks)
{
Flotr.draw(container, series, {
colors: colors,
HtmlText: true,
fontSize: 30,
radar: {
show: true
},
grid: {
circular: true,
minorHorizontalLines: true
},
yaxis: {
min: 0,
max: 7,
minorTickFreq: 1,
showLabels: false
},
xaxis: {
ticks: ticks,
titleAlign: 'right'
},
legend: {
position: 'ss',
container: document.getElementById("legendItems")
}
});
}
I'm not sure what else to try...
Accessing the variables from the window object before drawing the graph seems to work well.
window.Flotr.defaultOptions.fontSize = 8;
window.Flotr.defaultOptions.xaxis.color = '#000000';
Couldn't find a way to change the font weight.

Share tooltip between all series types

Working with tooltips in Highcharts I can see that not all type of series are included in the same tooltip. In the definition of my Highcharts object the property of tooltip look like:
tooltip: {
positioner : function (boxWidth, boxHeight, point) {
return {
x : point.plotX - 100,
y : point.plotY
};
},
shared : true
}
And how I am setting the tooltip property for each series is:
public getDefaultTooltip() {
return {
pointFormat : '<span style="font-weight: bold; color: {series.color}">{series.name}</span>: <b>{point.y} </b><br/>'
};
}
After read the documentation of tooltip I can see that shared property is not valid for series of type 'scatter', what is exactly the type of series that is not working for me. So, is there some workaround in order to make available all the data in the same shared tooltip?
in the example bellow I want to show all the series data in the same tooltip but the scatter serie is using a different popover. http://jsfiddle.net/rolandomartinezg/a6c4c4tv/1/
The ScatterSeries is defined in highcharts with noSharedTooltip = true. I think this is because the scatter series show both the x and y in their tooltips.
var ScatterSeries = extendClass(Series, {
type: 'scatter',
sorted: false,
requireSorting: false,
noSharedTooltip: true,
trackerGroups: ['group', 'markerGroup', 'dataLabelsGroup'],
takeOrdinalPosition: false, // #2342
kdDimensions: 2,
kdComparer: 'distR',
drawGraph: function () {
if (this.options.lineWidth) {
Series.prototype.drawGraph.call(this);
}
}
});
To get around this, you can use a line series instead of the scatter series with the lineWidth = 0. You also need to turn off the hover state for the series to avoid the line showing up on hover.
, {
type: 'line',
name: 'Average',
lineWidth: 0,
states: {
hover: {
enabled: false
}
},
data: [3, 2.67, 3, 6.33, 3.33],
marker: {
lineWidth: 2,
lineColor: Highcharts.getOptions().colors[3],
fillColor: 'white'
}
}
http://jsfiddle.net/a6c4c4tv/2/

Cannot get react-chartjs to update

I am trying to follow the "Example usage" code from react-chartjs github page
I am new to javascript and react and probably just being naive. How can I get the new chartData from "_onChange" to update my PolarAreaChart? I tried something more direct by calling element.getDocumentById("polarChart"), but that returns nothing and then I cannot call .update on it... the whole "insert redraw in the xml" and it will magically call update seems magical to me :(
PolarPlot.jsx
var React = require ('react');
var PolarAreaChart = require ('react-chartjs').PolarArea;
var FilterStore = require ('FilterStore')
var PolarPlot = React.createClass ({
componentWillMount: function () {
FilterStore.addChangeListener (this._onChange);
},
_onChange: function () {
console.log("time to update")
chartData = [
{
value: 300,
color:"#F7464A",
highlight: "#FF5A5E",
label: "Red"
}]
},
render: function () {
return (
<PolarAreaChart id="polarChart" data={chartData} options={chartOptions} redraw/>
);
}
});
var chartData = [
{
value: 300,
color:"#F7464A",
highlight: "#FF5A5E",
label: "Red"
},
{
value: 50,
color: "#46BFBD",
highlight: "#5AD3D1",
label: "Green"
},
{
value: 100,
color: "#FDB45C",
highlight: "#FFC870",
label: "Yellow"
},
{
value: 40,
color: "#949FB1",
highlight: "#A8B3C5",
label: "Grey"
},
{
value: 120,
color: "#4D5360",
highlight: "#616774",
label: "Dark Grey"
}
];
var chartOptions = [
{
//Boolean - Show a backdrop to the scale label
scaleShowLabelBackdrop : true,
//String - The colour of the label backdrop
scaleBackdropColor : "rgba(255,255,255,0.75)",
// Boolean - Whether the scale should begin at zero
scaleBeginAtZero : true,
//Number - The backdrop padding above & below the label in pixels
scaleBackdropPaddingY : 2,
//Number - The backdrop padding to the side of the label in pixels
scaleBackdropPaddingX : 2,
//Boolean - Show line for each value in the scale
scaleShowLine : true,
//Boolean - Stroke a line around each segment in the chart
segmentShowStroke : true,
//String - The colour of the stroke on each segement.
segmentStrokeColor : "#fff",
//Number - The width of the stroke value in pixels
segmentStrokeWidth : 2,
//Number - Amount of animation steps
animationSteps : 100,
//String - Animation easing effect.
animationEasing : "easeOutBounce",
//Boolean - Whether to animate the rotation of the chart
animateRotate : true,
//Boolean - Whether to animate scaling the chart from the centre
animateScale : false,
//String - A legend template
legendTemplate : "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<segments.length; i++){%><li><span style=\"background-color:<%=segments[i].fillColor%>\"></span><%if(segments[i].label){%><%=segments[i].label%><%}%></li><%}%></ul>"
}
];
module.exports = PolarPlot;
Your PolarPlot component is not rendered unless you explicitly change the state. Your chartData is not part of the component state. So assigning a new array to that variable does nothing more than that. Move this chartData to the component state. Then, whenever you update this state variable you are going to force the re-render. Something like this:
var PolarPlot = React.createClass ({
componentWillMount: function () {
FilterStore.addChangeListener (this._onChange);
},
getInitialState: function() {
return {chartData: chartData};
},
_onChange: function () {
console.log("time to update")
this.setState({
chartData: [{
value: 300,
color:"#F7464A",
highlight: "#FF5A5E",
label: "Red"
}]
});
},
render: function () {
return (
<PolarAreaChart id="polarChart" data={this.state.chartData} options={chartOptions} redraw/>
);
}
});
If you want to know more about how components rendering reacts to state changes check Reactive state section from the React Tutorial.

Highcharts Speedometer, dataLabel for mileage counter

There are several examples with the Speedometer in Highcharts.
Is there a way, to show an additional dataLabel only, without dial in the gauge?
It could show a trip recorder, mileage counter or day counter.
I tried additional series and dataLabels, but could not get it running.
http://jsfiddle.net/uqa0t3xw
series: [{
name: 'mileage counter',
data: [],
dataLabels: {
x: 0, y: 20,
format: '{y:.0f} km',
}
}]
If you want to have an additional data label by adding another series and hiding the dial you can do so by setting the color of the dial to "transparent" (JSFiddle):
series: [
// Our "hidden" series
{
name: 'mileage counter',
data: [0],
dataLabels: {
x: 0, y: 50,
format: '{y:.0f} km',
},
dial: {
backgroundColor: 'transparent'
}
},
// ... Other series
]
Also note how the y value has to be big enough to not overlap with the other data labels. If it overlaps it will be hidden, since gauge has allowOverlap: false by default. Alternatively you could set that to true, but overlapping might not be pretty.
It should be noted that this can also be solved by creating your own div and placing it in the correct spot or perhaps copying the data label from the first series and moving it slightly.

jqplot Canvas Over lay Max and Min

I have called the jqplot bubble renderer based on the event onchange of the combobox.
means the bubble renderer gets called everytime user change the value of the combobox.which eventually provides different sets of data to the bubble renderer. following is the code:`
$.jqplot.config.enablePlugins= true;
$.jqplot('bubbleChart2', [data], {
title : 'Committed Hours Vs Delivered Hours',
seriesDefaults : {
renderer : $.jqplot.BubbleRenderer,
rendererOptions : {
bubbleGradients: true,
varyBubbleColors: true,
autoscaleBubbles: true,
autoscalePointsFactor: -0.15,
autoscaleMultiplier: 0.85,
highlightMouseOver : true,
escapeHtml:true,
showLabels:false
},
shadow : true,
shadowAlpha : 0.1
},
axesDefaults : {
tickRenderer : $.jqplot.CanvasAxisTickRenderer,
labelOptions: {
fontFamily: 'Georgia, Serif',
fontSize: '12pt',
color: 'Green'},
},
axes : {
xaxis : {
renderer : $.jqplot.CategoryAxisRenderer,
label : 'Committed %',
labelRenderer: $.jqplot.CanvasAxisLabelRenderer
},
yaxis : {
autoscale : false,
label : 'Delivered %',
renderer : $.jqplot.CategoryAxisRenderer,
labelRenderer: $.jqplot.CanvasAxisLabelRenderer
}
},
grid:grid,
canvasOverlay: {
show: true,
objects: [
{line: {
name: "Performance Indicator",
start: [-200,-200],
stop: [1200,2200],
color: "#FF0000",
lineCap: 'butt',
shadow: false,
shadowAlpha: -15,
showTooltip: false,
lineWidth: 2
}},
]}
}).replot();`
Now I have problem in couple of different areas of the plot.
canvas over lay start and stop.
The data range to plot bubbles will be different so some of the bubbles are really big ans some of them are really small which doesnt make any sense to the plot.
any suggestion will be appreciative for my work.

Categories

Resources