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

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

Related

MPAndroidChart: Multi-line chart with filled area issue

I am now using the MPAndroidChart to draw line chartmy chart
As you can see from the above screenshot, the color specified by me(showed in legend) is not the same as the finally filled in below the chart, is there any way to make sure that the different color will not mixed together?
Below is the code I used to draw two of the lines
LineDataSet vlfDs = new LineDataSet(vlfValues, "VLF");
vlfDs.setMode(LineDataSet.Mode.CUBIC_BEZIER);
vlfDs.setCubicIntensity(0.2f);
vlfDs.setDrawFilled(true);
vlfDs.setDrawCircles(false);
vlfDs.setLineWidth(0);
vlfDs.setCircleRadius(4f);
vlfDs.setColor(Color.YELLOW);
vlfDs.setFillColor(Color.YELLOW);
vlfDs.setFillAlpha(100);
LineDataSet lfDs = new LineDataSet(lfValues, "LF");
lfDs.setCubicIntensity(0.2f);
lfDs.setDrawFilled(true);
lfDs.setDrawCircles(false);
lfDs.setLineWidth(0);
lfDs.setCircleRadius(4f);
lfDs.setCircleColor(Color.WHITE);
lfDs.setColor(Color.GREEN);
lfDs.setFillColor(Color.GREEN);
lfDs.setFillAlpha(100);
hrvLineData = new LineData(hfDs,lfDs,vlfDs, hrDs);
hrvLineData.setValueTextSize(0);
hrvLineData.setDrawValues(false);
hrvChartView.setData(hrvLineData);
hrvChartView.invalidate();
It's turned out that I need to use setFillAlpha(255) instead of setFillAlpha(100)
You can also use something similar to the following solution which overrides the default LineChartRenderer and a uses a custom implementation of IFillFormatter to fill only the areas between the datasets.
Android - Fill the color between two lines using MPAndroidChart

Keen IO Chart Labels

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"
}
});

Dojo tree grid shows ... for null valus

Hi I am using Dojo tree grid for my application,
For null values, Dojo tree grid uses "..." . I need to show it as empty field. Help me how to avoid "..." in tree grid display?
Sorry i couldn't add screenshot. Bcoz i dont have enough reputation
Thanks,
Siva
So I am assuming you are using dojox/grid/TreeGrid. You need a custom formatter function for your cells in the layout object you provide for the grid . Check out the documentation for the cell formatter http://dojotoolkit.org/reference-guide/1.10/dojox/grid/DataGrid.html. In your formatter you need to check if the value is not what you want and return an empty string.

Target specific slide in Soliloquy slider with url

Does anyone have any experience with using a url to target a specific slide in a Soliloquy slider? I am using multiple sliders that I need to link to specific slides of from external pages/sites. The Soliloquy Docs provide this info (soliloquywp.com/docs/dynamically-set-the-starting-slide/) as closest to the solution but, for a php noob like me, the explanation is a bit terse and lacking, my fault, not theirs.
The example given in the docs seems to be a custom filter for a specific slide in a specific slider. I need to target slides in multiple sliders with urls. I guess I need help understanding the filter's function. I have commented out what I think each part does. Maybe someone could show me where I'm wrong?
//OP: I don't understand, what ids/slides are represented by the 10 and 2 values in these parameters. Where do I find these?
add_filter( 'soliloquy_pre_data', 'tgm_soliloquy_dynamic_starting_slide', 10, 2 );
function tgm_soliloquy_dynamic_starting_slide( $data, $slider_id ) {
// If the proper $_GET parameter is not set or is not the proper slider ID, do nothing.
//OP: Is the 'sol_slide' parameter for ALL soliloquy sliders in my site or is it the name in the Dashboard given when constructing the slider?
if ( empty( $_GET['sol_slide'] ) ) {
return $data;
}
// Change this if you want to target a specific slider ID, or remove altogether if you want this for all sliders.
//OP: I believe to target ALL sliders in my site I should comment this out. Right?
if ( 51064 !== $slider_id ) {
return $data;
}
// Set the slide number as a config property. Also preventing randomizing slides.
$data['config']['start'] = absint( $_GET['sol_slide'] );
$data['config']['random'] = 0;
// Optionally prevent autostarting the slider. Uncomment if you want that.
//$data['config']['auto'] = 0;
return $data;
}
Basically, I guess I am asking for a little help with implementing this filter to target any slide in any slider with a url. Slim odds, but I'm dead in the water! Big thanks to anyone who can shed some light on this for me.
Complete, correctly functioning answer is here provided the plugin author, of course, duh: http://soliloquywp.com/support/topic/a-way-to-link-directly-to-a-specific-slide/
The value "sol_slide" is generic to any slider created with the plugin. Just put the custom filter provided in the example into your, hopefully, child-theme's functions.php, and construct your urls targeting specific slides like so: http://mywebsite.com/specific-product-page-with-slider/?sol_slide=3. Slide numbering is based on zero so 1 = 2 etc. Works like a charm.

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.