Change Background Color of Line Chart Entry on Selection in ios-charts - ios-charts

I'm using the iOS Charts framework and am trying to achieve this custom selection style.
Screenshot of Chart
In this screenshot, the blue circles are my line data entries, and the purple box that red arrow points to on the '15.2' entry represents what I'm trying to achieve. So basically, instead of the standard "crosshair" the framework provides when the user selects an entry, I'd like to draw a custom selection view under the user selected entry akin to the purple box.
I'm still new to this framework - is there an easy way to accomplish this I'm missing?

Well I've had a play and I couldn't find the iOS equivalent of the custom highlighter for android.
I have however changed the standard highlighter to match your requirements.
If you just disable the horizontal highlighter and adjust width then add colour/ alpha to your requirements you should be able to achieve what you need.
graphDataSet.setDrawHighlightIndicators(true)
graphDataSet.drawHorizontalHighlightIndicatorEnabled = false
graphDataSet.highlightLineWidth = 75
graphDataSet.highlightColor = UIColor.blue.withAlphaComponent(0.5)
graphDataSet is your LineChartDataSet
let graphDataSet = LineChartDataSet(values: someValue, label: "Label")

Related

GTK (GTK#) TreeView, make gridlines more visible?

I enabled gridlines like below.
tree.EnableGridLines = TreeViewGridLines.Both;
But the problem is the lines are barely visible like below (if you think there are no gridlines, zoom the image, and look really hard). Gtk.TreeView had GridLineWidth, but it was read-only. How can I make them more visible?
I have tried to find C# equivalent of the answer's C code and the following worked. Making the gridlines thicker worked but the problem was that in Ubuntu, the colour of the gridline is too light that it was not really visible even it it were thicker. So, I changed the colour instead.
var p = new CssProvider();
p.LoadFromData("*{border-color:darkgray;}");
tree.StyleContext.AddProvider(p,Gtk.StyleProviderPriority.Application);
You could use a CSS provider and set the grid line width to a larger value than one pixel. Again, the following code snippets are written in "C"; however, it should be easy enough to interpret the code to use equivalent C# statements.
First, off one would create a GTK CSS provider.
GtkCssProvider *provider;
provider = gtk_css_provider_new();
Then, the customized CSS style information would be defined for the CSS provider widget and the CSS provider widget would be associated with your tree view.
gtk_css_provider_load_from_data(provider, "*{-GtkTreeView-grid-line-width: 4;}", -1, NULL);
gtk_style_context_add_provider(gtk_widget_get_style_context(view), GTK_STYLE_PROVIDER(provider), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
Note that GTK defines a specific set of attributes for grid elements as opposed to using a standard element such as "border-width". The attribute needing customization in this scenario is "-GtkTreeView-grid-line-width".
Having set the grid width to an exaggerated width of four pixels, the following sample illustrates the effect of the custom CSS style enhancement.
I hope that points you in the correct direction.
Regards.

Using .roundedRect vs. cornerRadius of the layer for rounded corners

I was experimenting with creating a simple textfield in code and have been using UITextField.layer.cornerRadius to create a rounded corner, rather than using .roundedRect property of borderStyle, which I thought looked more restrictive.
So I just came back to wondering about it, and would like to know if there is any advantage to using .roundedRect?
It seems to display a default standard roundedness of the corners - can this be adjusted, or is it just there to be available off the shelf?
You can programmatically tune the border width and corner radius of the text field and any other view for the matter, by accessing its layer properties:
UITextField.layer.cornerRadius = 5.0
UITextField.layer.borderWidth = 3.0
On top of that, UITextField has a borderStyle property which you might want to play with. It has four possible values: None, Line, Bezel, and RoundedRect.
more check roundedRect apple doc
Displays a rounded-style border for the text field.
Advantage is if you are using .roundedRect it will give standard rounded-style & border Width whereas if you use .cornerRadius you can tune programatically the border width and corner radius.

get the color of a serie that is colorized naturally in xtrachart(devexpress 14.2)

i have some series that i have not specified any color for them and they are colorized naturally by xtrachart. how can i get the color of each of them when they are drawn in plot control?
i found that the color is stored in actual color property but i cant access it normally and i only can get it in debug mode in watch section.
how can i get the color?
You can utilize the SeriesViewBase.Color Property to specifies the series' color.
code snippet:
((SideBySideBarSeriesView)series.View).FillStyle.FillMode = FillMode.Solid;
((SideBySideBarSeriesView)series.View).Color = Color.Red;
From: How to: Custom Draw Series
You can also implement custom drawing in charts when drawing its
series. To do this you should handle the
ChartControl.CustomDrawSeries event, and then you're able to
change some drawing parameters using its event args.
References:
DevExpress forum: series colour
Changing colour of a series point at runtime
c# devexpress piechart series point color change
The answer is here:
get the color of a serie that is colorized naturally
Note that we had need to get the color that was automatically assigned to the series.

Word Styles to get two elements to share same background/border

Within MS Word 2013 I am trying to create a text element plus a list underneath it, all wrapped inside a coloured border with background shading (see image). The attached image shows the text in plain form.
I would like to place a blue border around both the title and the list. I can achieve this by placing both objects within a 1x1 table and applying colouring rules to the cell, but semantically this seems bad (I'm from an HTML development background where it is very wrong!)
When I edit a Style rule to create the border/background, it works well until I create the list, then it goes badly wrong. Is it possible to achieve the output of the table cell approach by only using a style rule and no table?
After a day of experimentation, the closest I can get is by doing the following:
Create a style rule called Tips Heading based on Normal, then set it to be Bold with a blue background.
Create another style rule called Tips List based on List Paragraph, and set it to have a blue background.
Unfortunately the List cannot be indented because the background colour also indents. The border is also affected in this manner, so I ignored the border and indentation. It works really well and is semantically well structured.

Composite Chart + Objective C

I want to implement below chart like structure.
Explanation:
1. Each block should be clickable.
2. If the block is selected, it will be highlighted(i.e. Red block in figure).
I initially google for this but was unable to find. What should be "Drawing logic" corresponding to this with animation?Thanx in advance.
I think you need to use MCSegmentedControl.
You can get it from here.
Generally speaking, I'd have an image for the outline with a transparent middle, then dynamically create colored blocks behind it of the appropriate colors, with dynamic labels. The highlighting is a little tricky, but could be done with a set of image overlays. One could also try to shrink and expand fixed images for the bars/highlighting, but iPhone scales images poorly.
(Will it always be 4 blocks? There are a couple of other ways to manage it using fixed-size images overlaying each other.)
Maybe you should look into using CALayer for this?
U need to implement this type of logic using button. Just scale button width according to percentage.
And to make round rect button like appearance use the code below and don't forget to import quartz-core framework in class file.
And to scale first and last button as you need some overlap from nearby button.
btn.layer.cornerRadius = 8.0;
btn.layer.borderWidth = 0.5;
btn.layer.borderColor = [[UIColor blackColor] CGColor];