Retrieve colour of diagram from sparx systems enterprise architect - enterprise-architect

Consider a below Image that is drawn in sparx systems enterprise architect tool is there any way to get the colour of each element like: blue, yellow. I know I cant get from tagged value because I have not mentioned.

Check EA.DiagramObject.Style
From the help file:
The Style attribute is used for setting the appearance of a DiagramObject; it is set with a string value in the format:
BCol=n;BFol=n;LCol=n;LWth=n;
where:
· BCol = Background Color
· BFol = Font Color
· LCol = Line Color
· LWth = Line Width
The color value is a decimal representation of the hex RGB value, where Red=FF, Green=FF00 and Blue=FF0000
DiagObj.Style = "BCol=35723;BFol=9342520;LCol=9342520;LWth=1;"
The following code snippet shows how you might change the style settings for all of the objects in the current diagram, in this case changing everything to red:
For Each aDiagObj In aDiag.DiagramObjects
aDiagObj.Style = "BCol=255;BFol=9342520;LCol=9342520;LWth=1;"
aDiagObj.Update
aRepos.ReloadDiagram aDiagObj.DiagramID
Next

Related

How to add legend for color saturation distribution into power bi Filled Map chart

i have a power bi report "Filled Map" chart, where Location = "Cedent Country", and Color Saturation = "Percentage Brokerage Over Premium".
Percentage Brokerage Over Premium = Percentage Brokerage Over Premium = IFERROR(Round(SUM('Production ReportV20-V1 Power B'[Total Brokerage])/SUM('Production ReportV20-V1 Power B'[Cedent Premium]),2),0)
In Format --> Data Colors i configured color saturation as below:
Minimum: Red
Center: Orange
Maximum: Green
I need to show in the chart Legend to display color distribution (Minimum: red, Center: Orange, Maximum: Green), but i couldn't find the option any where.
I created another field Description = IF([Percentage Brokerage Over Premium]<0.1,"Low",IF([Percentage Brokerage Over Premium]>0.25,"High","Medium")) and tried to drag it into Legend field section however nothing happened.
appreciate your assistance.
Best regards,
The Legend field only accepts a column, not measures as input. Therefore nothing will happen if you drag the measure to the field.
The reason why it only accepts a column is because it doesn't serve the purpose as what you mean for legend (i.e. concise explanation of the symbols used in a chart, diagram, drawing, map, table, etc.) [1]
Rather, it's for further slicing/breakdown of the data that you are interested in (e.g. Premium type/LOB, etc).
So my suggestion is that you can simply add a text box to type the legend (i.e. High: red, Medium: orange, Low: green); or better you can add an image with the diverging color and description to the report, like below.
Select chart and Visualizations -> select format tab
1) Select Data Colors
2) select conditional formatting on Default color near right side icon
3) Select Minimum and Maximum color

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.

Is it possible to customize the displayValue color individually in fusioncharts?

I am using the 3D Bar chart in FusionCharts. I have displayValues set to display numeric and textual values above the top of the bars. What I would like to be able to do is set the color of individual displayValues differently, for example, if the year-over-year change is positive, color the displayValue for just that bar to green, if it is negative, color it red, etc. Is this possible?
There is no direct way of coloring data plots or data values based on its value. But FusionCharts has an extensive API used to configure Annotations. You can use this API to create texts (data values). Just a rough thought came into my mind.

Changes Brightness in color replacement

I am working on replacing certain color in image by User's selected color. I am using OpenCV for color replacement.
Here in short I have described from where I took help and what I got.
How to change a particular color in an image?
I have followed the step or taken basic idea from answer of above link. In correct answer of that link that guy told you only need to change hue for colour replacement.
after that I run into the issue similar like
color replacement in image for iphone application (i.e. It's good code for color replacement for those who are completely beginners)
from that issue I got the idea that I also need to change "Saturation" also.
Now I am running into issues like
"When my source image is too light(i.e. with high brightness) and I am replacing colour with some dark colour then colours looks light in replaced image instead of dark due to that it seems like Replaced colour does not match with colour using that we done replacement"
This happens because I am not considering the brightness in replacement. Here I am stuck what is the formula or idea to change brightness?
Suppose I am replacing the brightness of image with brightness of destination colour then It would look like flat replacemnt and image will lose it's actual shadow or edges.
Edit:
When I am considering the brightness of source(i.e. the pixel to be processed) in replacment then I am facing one issue. let me explain as per scenario of my application.
for example I am changing the colour of car(like whiteAngl explain) after that I am erasing few portion of the newly coloured car. Again I am doing recolour on erased portion but now what happended is colour done after erase and colour before erase doesn't match because both time I am getting different lightness because both time my pixel of to be processed is changed and due to that lightness of colour changed in output. How to overcome this issue
Any help will be appreciated
Without seeing the code you have tried, it's not easy to guess what you have done wrong. To show you with a concrete example how this is done let's change the ugly blue color of this car:
This short python script shows how we can change the color using the HSV color space:
import cv2
orig = cv2.imread("original.jpg")
hsv = cv2.cvtColor(orig, cv2.COLOR_BGR2HSV)
hsv[:,:,0] += 100
bgr = cv2.cvtColor(hsv, cv2.COLOR_HSV2BGR)
cv2.imwrite('changed.jpg', bgr)
and you get:
On wikipedia you see the hue is between 0 to 360 degrees but for the values in OpenCV see the documentation. You see I added 100 to hue of every pixel in the image. I guess you want to change the color of a portion of your image, but probably you get the idea from the above script.
Here is how to get the requested dark red car. First we get the red one:
The dark red one that I tried to keep the metallic feeling in it:
As I said, the equation you use to shift the light of the color depends on the material you want to have for the object. Here I came up with a quick and dirty equation to keep the metallic material of the car. This script produces the above dark red car image from the first light blue car image:
import cv2
orig = cv2.imread("original.jpg")
hls = cv2.cvtColor(orig, cv2.COLOR_BGR2HLS)
hls[:,:,0] += 80 # change color from blue to red, hue
for i in range(1,50): # 50 times reduce lightness
# select indices where lightness is greater than 0 (black) and less than very bright
# 220-i*2 is there to reduce lightness of bright pixel fewer number of times (than 50 times),
# so in the first iteration we don't reduce lightness of pixels which have lightness >= 200, in the second iteration we don't touch pixels with lightness >= 198 and so on
ind = (hls[:,:,1] > 0) & (hls[:,:,1] < (220-i*2))
# from the lightness of the selected pixels we subtract 1, using trick true=1 false=0
# so the selected pixels get darker
hls[:,:,1] -= ind
bgr = cv2.cvtColor(hls, cv2.COLOR_HLS2BGR)
cv2.imwrite('changed.jpg', bgr)
You are right : changing only the hue will not change the brightness at all (or very weakly due to some perceptual effects), and what you want is to change the brightness as well. And as you mentioned, setting the brightness to the target brightness will loose all pixel values (you will only see changes in saturation). So what's next ?
What you can do is to change the pixel's hue plus try to match the average lightness. To do that, just compute the average brightness B of all your pixels to be processed, and then multiply all your brightness values by Bt/B where Bt is the brightness of your target color.
Doing that will both match the hue (due to the first step) and the brightness due to the second step, while preserving the edges (because you only modified the average brightness).
This is a special case of histogram matching, where here, your target histogram has a single value (the target color) so only the mean can be matched in a reasonable way.
And if you're looking for a "credible source" as stated in your bounty request, I am a postdoc at Harvard and will be presenting a paper on color histogram matching at Siggraph this year ;) .

How to figure out the html color of an Interface Builder Color

I need to take the neat IB Color I have chosen for my background, and figure out the html color code so I can call it in the css declarations in the UIWebView content NSString. Easy way of doing this?
http://screencast.com/t/M2E3MmI5Yj
Click on the Tint box in interface builder (your colour).
Click on the RGB sliders. These will be in decimal format.
Convert each number to hexadecimal with Google.
For example with the query: 255 in hexadecimal.
The last two letters in this case FF is the color.
Your html color is:
#RRGGBB
Where R is for red, G for green and B for blue.