Fsharp.Chart: Data series labels in StackedColumn chart - charts

I want to draw a conventional stacked chart, with a legend showing what the colours mean, but what I get is a legend box showing lots of names of the form "Stacked_GenericChart_Series_1_4"
The standard way of creating the chart (by giving the constructor a 'a*'b seq seq) doesn't seem to have any way of setting the series names, either before or after the chart has been created. On the other hand, the old-fashioned way (explained at http://blogs.msdn.com/b/carlnol/archive/2011/10/27/fsharpchart-release-supporting-stacked-charts-version-0-60.aspx), which would enable me to add a name to every chart, doesn't work at all with the current chart library, because the current one won't take a 'a*'b seq.
I note the source shows a constructor parameter called "Labels", but it's commented out.
There must be some way to set a chart's labels! Where should I be looking?

Related

Is there a way to force "Categorized" symbolization to use attributes in the table for e.g. color definition?

I have a map with a couple of dozen of different "categories" of polygons and would like to symbolize them using the "Categorized" symbolization in QGIS. Every category already has its color defined in a "fill_color" attribute within the table.
I would like the symbolization to honor that color definition instead of assigning some color of its own to the categories.
Is there a way to do this, without manually going through every category and changing its color?
I'm not a Python programmer, so if there is a possibility of programming this, it's beyond me.
The software itself does not offer the option to do what I need in "Categorized" symbolization, although you can do it in "Single Symbol". If you try it in "Categorized" it will let you do the same steps, but the program will nevertheless use colors of its own choosing.
Of course, if I go the "Single Symbol" way, I can't generate a proper legend of map units in Layout.

AnyLogic - make many edit boxes visible depending on variable

Here is a simplified example of my problem:
I want to make the edit box 1 or 2 visible, depending on whether a checkbox of box 1 or box 2 is checked. The variables "variableCheckbox1" and "variableCheckbox2" are connected to the respective ceckboxes.
I have written a function as shown in the picture. The function is called from the EditBox 1 ("Enabled"). This is a possible solution for ONE box each.
Does anyone have an idea if there is a more elegant way to do this for a very high number of checkboxes / edit boxes?
A possible solution would be to write a function with a switch case for each variable in my model, called from each box. A very inelegant solution would be to make a single function for each box, but I don't consider that a good way.
If you want this for a large number, turn the entire setup into its own agent type: Checkbox and editbox. Instantiate as needed, you can add a parameter to specify what this is about exactly...
This would be the most generic and powerful approach...
if this works for you, you can use replications for checkboxes and editboxes and associate them together through the index... and then just add the code in the visible field of the edit box... Of course you will have to determine their positions programatically

Re-style entire Leaflet vector map on event

I want to restyle every feature on a vectorgrid. The specific problem is when you select a section of a bus route, potentially by just a mouse-over, i want to light up all the sections which contain common routes. I have a style callback function. How do I tell Leaflet that I have changed the rules on what colours to use etc.

Change default group colors in Zeppelin visualizations

I have a bunch of data that I'm putting into a scatter plot, but the default color ordering is "blue", "lighter blue", and then finally "orange". My data comes in two groups, with constant group names, and no mater what I do, they're always the blue and lighter blue. Which does NOT make for a good visualization.
So far, I haven't found a way to modify the color ordering, or to set specific colors for the known groups. I also haven't been able to change the colors by adding a dummy group (of one element) and playing with the ordering in the SQL statement.
Any help?
Here's a workaround/hack for that missing Zeppelin feature.
Charting in Zeppelin is based on nvd3 (which in turn uses the D3 library). As Zeppelin simply doesn't care about colors yet, it'll always use the nvd3 default, which is defined in the utils.js function nv.utils.defaultColor.
So, to change the color scheme, you can simply override this function. Try out the following JavaScript code in your browser's console. For available color schemes, see the API documentation (note, that Zeppelin still uses the old 3.x version of D3).
nv.utils.defaultColor = function() {
return nv.utils.getColor(d3.scale.category10().range());
}
The remaining problem is, how to permanently add this to your Zeppelin instance, which depends on your environment. It is sufficient to add the above code to the end of your index.html, however this involves modifying the zeppelin-web-x.y.z.war file.
In the end, with above code, you get something like this.

Disable FontSmoothing in Legend text objects

I am on Matlab R2018a. I want to disable FontSmoothing for text legend entries.
Setting the FontSmoothing property default vaue to 'off' for text objects doesn't seem to apply to text objects created by a legend ;
Using the old syntax [lgd,object_h]=legend(...) is horrible under recent releases : for some reason it leads to a drawnow inside the legend call, thus if I then want to edit the relevant properties of some of object_h (here to set their FontSmoothing to 'off'), there will be two draws, leading to a less responsive call and ugly behavior (two screen refreshes instead of just one). Although this behavior makes it unacceptable to me, I can though use these handles to then set their FontSmoothing property to 'off' and it works.
Not using the old syntax but only the new one lgd=legend(...) thus seems to be the only recourse. I seem to be able to find the text objects by accessing lgd.EntryContainer.NodeChildren(1).Label (1 for the first text object, 2 for the second one, etc). Problem is, property setting seems iffy at best :
set(lgd.EntryContainer.NodeChildren(1).Label,'FontSmoothing','off') doesn't change anything.
set(lgd.EntryContainer.NodeChildren(1).Label,'FontSize',somevalue) doesn't change anything either.
set(lgd.EntryContainer.NodeChildren(1).Label,'String','sometext') does work though.
Anyone have any idea how to proceed ?