Accordion not working in Highcharts subtitle - highcharts

I have sometimes very long subtitles in my charts. Ideally I want to expand/collapse part of the subtitle.
If I use ang-accordion outside of the highcharts subtitle, it works correctly
https://github.com/sherwaniusman/angular-accordion
If I try to use it in the subtitle however (in highcharts.net) it doesn't show me text1, nor is anything clickable.
var subtitle = string.Format("<ang-accordion><collapsible-item item-title='{0}'><div>{1}</div></collapsible-item></ang-accordion>",text1, text2);
subtitle = new Subtitle { UseHTML = true,Text = subtitle, Align = HorizontalAligns.Left },
Is it feasible to use expand/collapse functionality in the subtitle?

Per the documentation it does not look like angular tags are supported. Taken from here:
Texts and labels in Highcharts are given in HTML, but as the HTML is
parsed and rendered in SVG, only a subset is supported. The following
tags are supported: b, strong, i, em, br/, span. Spans can
be styled with a style attribute, but only text-related CSS that is
shared with SVG is handled.

Related

Highcharts column chart formatting

We have been given a mock up:
Im looking around on highcharts but i dont see if i can do this. The thing im looking for specifically is a custom string/value above the x axis category.
As far as i can see the x axis category is just an array of strings, so i cant use html or anything even
From docs:
HTML in Highcharts
Texts and labels in Highcharts are given in HTML, but as the HTML is
parsed and rendered in SVG, only a subset is supported. The following
tags are supported: <b>, <strong>, <i>, <em>, <br/>, <span>. Spans can
be styled with a style attribute, but only text-related CSS that is
shared with SVG is handled.
Most places where text is handled in Highcharts, it is also followed
by an option called useHTML. When this is true, the text is laid out
as HTML on top of the chart. This allows for full HTML support and can
be a good idea if you want to add images in your labels, tables in
your tooltip etc.
So, you can use HTML tags in categories array, for example:
xAxis: {
...,
categories: [
'<span style="font-size: 16px; color: red;">-22.5%</span><br>CLIENT<br>CALLS',
...
]
}
Live demo: http://jsfiddle.net/BlackLabel/kLu7rtea/
Docs: https://www.highcharts.com/docs/chart-concepts/labels-and-string-formatting
API Reference:
https://api.highcharts.com/highcharts/xAxis.categories
https://api.highcharts.com/highcharts/xAxis.labels.useHTML

How to change dashs style in Vaadin 14 graphs?

In Vaadin 14, I'm trying to determine how to change the graph's line style from solid to dashed? (I need to do this programatically.) At first, it seemed trivial (based on https://vaadin.com/blog/styling-your-vaadin-charts), but I do not see API for either color setting (eg
PlotOptionsLine redBirdOptions = new PlotOptionsLine();
redBirdOptions.setColor(new SolidColor("#d62031"));
) or dash-style setting available in Vaadin 14. Anyone have examples on how one can programmatically set the dash style (and color) of series in a Vaadin 14 line graph?
Disclaimer: There is no way to do it Java only. You would need to style chart using CSS. Though, the color can be changed via styles settings in Java like shown here Treemap custom colors, I will follow the CSS approach below
The documentation you are referring to is for Vaadin 8, which uses another version of the highcharts library. In Vaadin 14, you need to configure settings via css. There is no example especially for your use case, but you can find in the links below all the needed info :
CSS file configuration and correct import annotation CSS Styling
Class names that can be used to style charts Highcharts API
The color is set using .highcharts-color-{n} class (or the --vaadin-charts-color-{n} property, which is preferred here), where n can be defined for options on Java side like this : plotOptions.setColorIndex(2);. A highchart example for colors can be found here : CSS Colors
For dashed css you could check this : CSS dashstyle.
Overall, this should do the trick:
Create a chartStyles.css file
Put the content below there :
:host {
--vaadin-charts-color-2: red;
}
.highcharts-series-0 {
stroke-dasharray: 1, 3;
}
Import the style using :
#CssImport(value = "./styles/chartStyles.css", themeFor = "vaadin-chart", include = "vaadin-chart-default-theme")
Plot options have colorIndex of 2 (as this is the value in css we are referring to):
PlotOptionsAreasplinerange range=new PlotOptionsAreasplinerange();
range.setColorIndex(2);
dataSeries.setPlotOptions(range);
After that the chart color should change. You can skip the index assignment and use --vaadin-charts-color-0, if you have only one chart on the page. If not, I would suggest to add theme names to the chart and adjust css file to use them. This way you would ensure that only the chart you want is affected.

Core Plot Title Alignment and Font Style

Is there any way an alignment can be provided for the title in Core Plot apart from setting the graph title displacement.I am having a dynamic graph title and hence the title displacement would also have to be adjusted accordingly for each case. Also is there a way to set the font Style of the title say make it Bold?
If the titlePlotAreaFrameAnchor and titleDisplacement don't give enough control, you can always use a Core Plot layer annotation to position your own custom title anywhere you want.
Core Plot text styles include several properties including the font, size, color, bold, and italics. If you want the whole title to use one style, just set the title string and the titleTextStyle. If you want parts of the title to have different styles, use the attributedTitle (which takes an NSAttributedString) instead. See some of the plots in the Plot Gallery example app for sample code.

treemap highcharts group by

I have designed a treemap using highcharts with custom algorithm.It has a drilldown to 1 level. There is a drop down for my chart and it has two options for selection. treemap is displayed on the basis of dropdown selection which has a group by feature implemented using underscore.js library. The feature is working fine. But the problem is, all the tiles which are grouped together, are placed next to each other. My requirement is : i want all those tiles to be packed in one big tile with one label. something like header title in D3(exactly the same). Please let me know how to go about it. Is it something like treemap within a treemap? Also i wanted to know if its feasible to have different labels and tooltips for parent and children in the same treemap. any leads would be helpful.
actual image

How would I change the color of an emoji?

I have an emoji, and I want it to be white, but when I run the program it appears red. How do I change it to white?
rating.text = "\(♥♥♥♥♥)"
rating.textColor = UIColorRGB("ffffff")
The following answer explains why you can't change the color of Emoji characters. The glyphs are essentially images.
If you want to be able to use a heart symbol that you can color, try using one of the non-Emoji heart characters like ♥︎.
Or ensure the label's font isn't using the Apple Color Emoji font.
I needed to do this for a project and found a couple of ways to go about it. Each has its limitations, but still, usefull tricks to know.
First, you could append the unicode text presentation selector after the emoji to get it to render as text, then use your font color.
Limitations:
Text representation of that emoji might not be available and you get unknown character representation instead.
The detail of the text representation is often less
Alternatively, you can use CSS filters on the emoji itself to change its hue (plus saturation, contrast, grayscale, etc)
Limitations:
Requires access to the page's css (Works fine for your own webpage, but you couldn't, for instance, use this within an instagram post)
The emoji graphic is application-dependent, so the outcome
could be unpredictable. For instance, the folder icon on firefox is
(presently) an ugly blue color. I filter it to a yellow tint, but on
other browsers (which render it yellow to start with) the code below will cause the very problem I was trying to fix!
Anyway, here are some examples with both css and html variations of the approaches:
.folderitem_normal:before {
content:'\1f4c2';
margin-right:4px;
}
.folderitem_presentation_selector:before {
color: magenta;
content:'\1f4c2\FE0E';
margin-right:4px;
}
.folderitem_css_filter:before {
content:'\1f4c2';
filter: hue-rotate(180deg) brightness(1.5);
margin-right:4px;
}
<div class="folderitem_normal">Normal appearance of emoji for comparison (HTML 📂)</div>
<div class="folderitem_presentation_selector">Presentation selector. Notice how it has been colored like normal text. (HTML 📂︎)</div>
<div class="folderitem_css_filter">Css filter looks nice, but results are application-dependent. (HTML = N/A)</div>

Resources