In mapbox_ios:
1. About MGLFillStyleLayer and MGLLineStyleLayer, how to set different styles (color, width, dotted line) for individual features.
A scene: if it is a separate polyhedron with no connection between the two surfaces in different places, but it is a feature, if I want to add more polyhedron to modify the graph (add a point and connect the two sides), how to modify the graph?
Hope to get help, thank you!
To answer your first question, you can style individual features within a style layer based on feature attributes.
Get started by adding the layers to your map. You could create your source, then style the layer's color based on the value in the feature attributes. Use the lineColor property for your MGLLineStyleLayer and fillColor to change the color of your MGLFillStyleLayer.
For example:
let layer = MGLLineStyleLayer(identifier: "layer", source: source)
layer.lineColor = NSExpression(forKeyPath: "color")
style.addLayer(layer)
You can also create a dictionary with possible attribute values and the color you would like to use as values. This example shows that approach by using icon images.
Related
I would like to know what are the settings capabilities on workshop charts when implementing multiple layers.
Here is an example of a chart with 2 layers (3 objects):
Among the global settings options, I would like to know:
how to have only one legend per group, instead of one per layer?
how to manage colors? Is it possible to change default?
is there any way to display dotted lines for example?
Thanks in advance
how to have only one legend per group, instead of one per layer?
Currently all the legend "flattens" all the series across all the Plot Layers and there isn't any way to change the grouping. If you really wanted to, you could use a couple metric widgets in List or Tag mode and build your own legend alongside the chart, assuming you'd made overrides for all the potential series and series segments (see below).
how to manage colors? Is it possible to change default?
Yes, you can change the color for each series on the chart. If the series has no "Segement By" config, then you can choose the color directly. If you choose to segment by some other property, then you need to add a Segment Display Override for each segment value that you want to change.
is there any way to display dotted lines for example?
You can change the style from solid to dashed in the same place that you can change the color
i am looking for a way to make a point chart based on multiple nominal conditions. i am plotting 2 values on x and y, but i would like to differentiate these points based on year as well as 'type'.
currently, the way i do it is to assign year to color while 'type' is assigned to shape
color=alt.condition(selection, alt.Color('Date:T'), alt.value('lightgray'), scheme='red' )
shape = alt.Shape('type:N')
a few questions:
is it possible to change the color scheme of the points instead of the default colors to say shades of red/blue/black, etc?
is it possible to assign one color scheme/shade (instead of shapes) to 'types'?
is it possible to change the color scheme of the points instead of the default colors to say shades of red/blue/black, etc?
Yes, see https://altair-viz.github.io/user_guide/customization.html#customizing-colors. You can use any of the built-in Vega color schemes, or define your own using the methods discussed there. From your example, it might look something like this:
color=alt.condition(
selection,
alt.Color('Date:T', scale=alt.Scale(scheme='reds')),
alt.value('lightgray')
)
is it possible to assign one color scheme/shade (instead of shapes) to 'types'?
No, there is no built-in way to apply two color scales based on two fields in the data (how would a mark choose between the two colors assigned to it?) One possible approach would be to use an opacity encoding for the second field, which is reflected in the lightness of the marks. For your example, it might look like this:
opacity='type:N'
I'm wondering if there is a way to take off some of the default labels on a leaflet tile base-map. For example, I'm using the leaflet "dark matter" tile-set, found here, I believe: 'http://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}.png'
I'd like to only put on country labels, or city labels, in certain places. By default, the labels already seem to be set. Any way to change this? Thanks in advance!
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.
I am trying to use PNG images as Toolbar icons. I am currently reading them with imread an set the corresponding CData value.
Now I have some images with transparency. There is no alpha channel (I found some threads with solutions for that), but I get some kind of "Simple Transparency". The imfread function returns "simple" for the Transparency field and a vector of values between 0 and 1 for the SimpleTransparencyData field.
I couldn't find any information about this transparency type neither in the Matlab help nor the internet. So I would like to know if it is possible to show the transparent image in the toolbar directly, or if not how to composite the transparent values with the toolbar's background color.
In summary you set the CData value to be a NaN to represent transparency.
See this article that I wrote on undocumentedmatlab.com which describes how to do it for uicontrols.
For a toolbar icon you modify the CData property in the same way - the primary difference is that you dont need to modify the backgroundcolor property.
I did a quick test on the only solution I could probably imagine and it really seems to work:
I forgot to mention, that I am using indexed PNG files for this. But this sort of transparency seems to imply this fact.
The indexed colors are ordered that the (partially) transparent colors are at the beginning of the table. The SimpleTransparencyData now specifies the transparency of each of the indexed colors. Non-transparent colors are left out, as there are more colors than transparency values.
With that additional information it is easy to composite a single background color with the image.