Keen IO Chart Labels - keen-io

I'm trying to figure out how to adjust the labels on an Area Chart visualization of my Keen IO data. I've looked through the available configuration options, but I'm not seeing what option would do this. Currently my chart just lists "null" on the legend on the right side of the chart, and on the hover tooltips when you hover over a particular peak. Just looking to switch it to list "Hits" instead of "null."
Does anyone know how/where I would configure those labels?

You can use labelMappingfor that. Something like:
client.draw(funnel, document.getElementById("chart"), {
library: "google",
chartType: "columnchart",
labelMapping: {
null: "Hits"
}
});

Related

PyVis Graph shows some nodes colour as green and some as yellow even though the nodes are assigned with colour green

I have generated a PyVis graph but the graph output has just one problem and seems i can't find the reason and lost to no ideas anymore, i am not sure if it is a bug in PyVis drawing or I have made an error in generating the graph. Please advise, i am keen to know the cause here.
The PyVis graph I have generated contains 196 nodes and 367 edges exactly.
Of those 196 nodes, certain group of nodes are assigned with specific colours. About 42 nodes are assigned with colour "green" (using hex colour code #00ff00) and their shape has been changed to be a Square here for easy visual in an attempt to show my problem.
Of those 42 nodes, 13 of them are not showing green but instead show yellow as their colour, even though the source code still have those nodes colour as green (in hex code), however the visual shows yellow.
Below one line code is me trying to point to the source code line of one node and its color is set to #00ff00.
{"color": "#00ff00", "font": {"color": "white", "face": "Verdana", "size": 90}, "group": "gp_b", "id": "node__120", "label": "node__120", "level": 3, "shape": "square", "size": 500} ,
The graph's full html code example is provided here linked to jsfiddle, please see if you can help me locate the problem and a fix. Thanks in advance.
https://jsfiddle.net/shashi12345/2pf781ba/1/
Additional info:-
Basically, the graph is first created using Python. I used NetworkX version 2.8.5, added nodes and edges and their attributes, and then imported that into PyVis all within Python. PyVis version i am using is 0.2.1. And the graph is generated/saved as html file from PyVis.
The vis.js vis-network library requires groups to be defined in the options as descibred in the documentation here. All square nodes are added to a group named gp_b however this isn't present in the vis-network options. It is odd that this results in the behaviour being seen, but it could be resolved in a number of ways described below.
As per the PyVis documentation here the options passed to vis.js can be configured which as is needed for some options below.
Adding Group to Options
Adding the group gp_b to the options without any styling defined fixes the issue, for example:
var options = {
groups:{
useDefaultGroups: true,
gp_b:{ }
},
// Other options
}
Adding Group to Options With Styles
Alternatively the styling could be removed from the nodes and instead placed on the group, for example:
var options = {
groups:{
useDefaultGroups: true,
gp_b:{
color: '#00ff00'
}
},
// Other options
}
Removing Group from Nodes
The group could also be removed from the nodes, this way they are not expecing style information from the group and will just the color they have defined.

Xlsxwriter: how to disable text wrap in data label?

I'm generating pie charts using XLSX writer, and everything is going perfectly except for one thing: I can't seem to find a way to control the text from wrapping in my data labels (which contain percentage values). Any font size above a 10 causes the '%' symbol to wrap below the digits (you can see this in the image I've attached below). I'm trying to generate many charts, so adjusting them manually could be costly time-wise.
The docs suggest that wrapping can be enabled or disabled from num_format. For cells, this property is set with a 'format' object. However, while data label text has a num_format property, the docs explicitly state that it must be set with a string literal and cannot take a format object. I have no clue how to prevent string wrapping with a string literal format.
Alternatively, I've looked into expanding/reducing the width/height of the data labels. However, this option also seems to be missing from the library.
From what I can tell, none of the other properties seem to suggest a way to avoid wrapping text.
My question is, is there a solution I'm missing? I'll leave some of my output and code below.
Current Code:
chart.add_series({
'categories' : '={}!B1:C1'.format(product_sheetname),
'values' : '={}!B2:C2'.format(product_sheetname),
'data_labels':{
'percentage':True,
'fill': {'color':'#363636'},
'font': {'name':'Arial (Body)', 'color':'white', 'size':16},
},
'points' : [
{'fill':{'color':'#4471d2'}},
{'fill':{'color':'#ff871c'}}
]
})
Current Output:
UPDATE:
A quick fix per the comment below is to scale up the size of the chart in general. While this solves the wrapping issue, it defeats the purpose of using a larger font.
There isn't any way in XlsxWriter to adjust the size of the data label but Excel should do it automatically to get the best result.
I tried to replicate but didn't see the text wrap that you are getting (even though I tried 3 different versions of Excel):
import xlsxwriter
workbook = xlsxwriter.Workbook('chart_pie.xlsx')
worksheet = workbook.add_worksheet()
worksheet.write_row('B1', ['Apple', 'Cherry'])
worksheet.write_row('B2', [53, 47])
chart = workbook.add_chart({'type': 'pie'})
product_sheetname = 'Sheet1'
chart.add_series({
'categories' : '={}!B1:C1'.format(product_sheetname),
'values' : '={}!B2:C2'.format(product_sheetname),
'data_labels':{
'percentage':True,
'fill': {'color':'#363636'},
'font': {'name':'Arial (Body)', 'color':'white', 'size':16},
},
'points' : [
{'fill':{'color':'#4471d2'}},
{'fill':{'color':'#ff871c'}}
]
})
worksheet.insert_chart('B3', chart, {'x_offset': 25, 'y_offset': 10})
workbook.close()
Output:

Adding custom value to AmLegend valueText/periodValueText in AmXYChart

I am trying to plot line chart with AmXYChart instead of serial chart as I wanted to update all the line independently on a real-time basis. And also wanted to update valueText in legend for all line graphs dynamically.
I am able to get valueText and periodValueText in case of AmSerialChart but unable to get or set it in case of AmXYChart. Following is my legend setting in serial chart:
"legend": {
"valueWidth": 100,
"valueAlign": "left",
"valueText": "[[close]]",
"periodValueText": "[[value.close]]",
},
Any help will be appreciated, Either by amChart settings or by custom way.

Highcharts - Add Point to chart with different color based on some condition dynamically

everyone ! I;m working on a Highchart where it appends values to the chart for every 5 seconds time. I'm adding points like this,
series.addPoint([(new Date()).getTime(), xnum(n.PointValue)], true, true);
When adding a point I want to add the point with a different color (RED) based on some other property. Can anyone help me to add the point with a different color ? Thanks
You could pass the color directly while adding a new point. Instead of array try using an object with a property 'color'.
series.addPoint({
y:(new Date()).getTime(),
x:xnum(n.PointValue),
color:some_condition?'red': 'blue'},
true, true);
An example pen
https://codepen.io/samuellawrentz/pen/XYVBjR?editors=1010

GTKmm - unable to set fixed size to Gtk::Scale widget

I am writing a simple photo viewer in C++ using gtkmm and I can not sort out how to set widget size. In the bottom of main window I have Gtk::Box with 3 buttons, a label and a Gtk::Scale widget. I would like to set fixed size to Gtk::Scale widget and buttons, and give rest of the space to label. I have only managed to set fixed size to buttons, and divide extra space evenly between label and scale widgets, by adding widgets like this:
bottom_box->pack_start(*left_button, false, false);
bottom_box->pack_start(*right_button, false, false);
bottom_box->pack_start(*filename_label, true, true);
bottom_box->pack_start(*image_zoom, true, true);
bottom_box->pack_start(*fit_button, false, false);
When I try to set both expand and fill to false while adding image_zoom to bottom_box, the widget is way to small, and set_size_request() makes no change. Is there another way to do it?
Code responsible for creating the window is here (the rest is in the repository): https://github.com/jjkrol/ZPR/blob/master/src/gui.cpp
Thank you very much in advance.
I've sorted this out, I think the problem was associated with fact that I've called set_size_request() before adding Gtk::Scale to Gtk::Box.