How to generate a wavesurfer with multiple peak colors using videojs-wavesurfer or wavesurfer.js? - video.js

Is there a way to have multiple colors with the peaks using videojs-wavesurfer?
Please refer to the below image for ref.
Current implementation of videojs-wavesurfer with video is giving the output as below
videojs-wavesurfer ref link https://collab-project.github.io/videojs-wavesurfer/#/

Related

How to display more than one image dynamically with python (pyqt5)?

I'm using python to build an application by PyQt5, the main idea is to display images from a directory and for each image some masks show up next to it to select one of them (i.e. for each image there are different number of masks). So, I want to display these masks in a "container" that can handle this dynamically.
I tried QlistWidget in a scroll area and the masks are displayed as icons in it, but I want to use something else to handle them easier and retrieve any mask as Qpixmap or QImage to use it in another operations without convert it multiple times (which slows down the program)
this is the part that displays the masks (this is the only way that worked with me)
for ann in annotations:
mask = self.coco.annToMask(ann)
mask_img = Image.fromarray((mask*255).astype(np.uint8))
qt_img = ImageQt.ImageQt(mask_img) # convert Image to ImageQt
icon = QtGui.QIcon(QtGui.QPixmap.fromImage(qt_img))
item = QtWidgets.QListWidgetItem(icon, f"{annIndex}")
self.listWidget.addItem(item)
annIndex += 1

Is there a way to query the Portfolio Item Status (Color) in Rally?

I'd like to use the custom list app in Rally to display only those Portfolio Items that have an At Risk / Red status (see Rally documentation) so I can create a list of items needing attention/for discussion.
e.g. something like (PercentDoneByStoryPlanEstimate.Status = "At Risk")
Is this possible? Or would I need to recreate the colour logic in my query?
I like the concept. Unfortunately, the status color calculation is a bit involved and depends on a lot of different fields. It's not stored as an attribute on the artifact but rather calculated in real time as needed. It would probably be more feasible to load all of the portfolio items first, apply the health color calculations, and then filter by the color hex value before adding the data to a grid.
The status color would be retrieved like so:
var colorObject = Rally.util.HealthColorCalculator.calculateHealthColorForPortfolioItemData(recordData, 'PercentDoneByStoryCount') // Or 'PercentDoneByStoryPlanEstimate'
The hex value would then be accessed via colorObject.hex.
And the hex values used by Rally are:
Red: #F66349
Green: #8DC63F
Yellow: #FAD200
White: #E0E0E0
Grey: #D1D1D1

EaselJS: Is there any way to export a shape to an image file?

I have a project in CreateJS which I'd like to remake without CreateJS, but it seems that all my images are in an EaselJS shape format. For example:
this.shape_1 = new cjs.Shape();
this.shape_1.graphics.f("#465762").s().p("AgOAOQgFgFAAgJQAAgHAFgHQAHgFAHgBQAIABAHAFQAFAHAAAHQAAAJgFAFQgHAHgIgBQgHABgHgHg");
this.shape_1.setTransform(43.4,42,0.747,0.747);
Is there some method I could use to export that to an image file?
You can export any EaselJS DisplayObject by caching it, and then exporting the dataURL. Note that you have to know the raw bounds. If you want a larger cache of it, just increase the scale parameter.
this.shape_1.cache(x, y, w, h, [scale]);
var url = this.shape_1.getCacheDataURL();
Unfortunately this method does not support the parameters of the Canvas.toDataURL(), so if you want that, you can hit the cache directly:
this.shape_1.target.cacheCanvas.toDataURL(…[type], [encoderOptions]);
Then, you can use the dataURL in a number of ways. Here is an article on it. Alternatively, just throw the generated cache into the DOM, and right-click on it to save.
document.body.appendChild(this.shape_1.target.cacheCanvas);
Docs:
DisplayObject.cache()
EaselJS getCacheDataURL()
Canvas.toDataURL()

WSO2: Dashboard Issues and Personalization

I am using wso2cep dashboard for displaying network traffic related information by exploiting various graphs. I was wondering if there is any way I can customize legend for each type of graph or set it globally as its create confusion for the viewer, elaborated in screen shot.
In piechart others = blue
In dest port vs src ip other = orange
One thing more
Scatter plot is shifted to left side of the window cutting ips on the y-axis and there is a space left on right side which can be used.
How can I drag the chart towards right side?
And also scatter chart is not rendering multiple y-axis values against single x-axis value. Here is the screen shot for that and values against it is plotted.
source_ip, source_port, destination_ip, destination_port, protocol
192.168.227.102,123,192.168.227.101,21,ftp
192.168.227.102,101,192.168.227.101,21,ftp
192.168.227.105,445,192.168.227.101,21,ftp
192.168.227.105,123,192.168.227.101,21,ftp
192.168.227.105,65576,192.168.227.101,22,ssh
192.168.227.109,123,192.168.227.101,22,ssh
192.168.227.109,123,192.168.227.101,22,ssh
192.168.227.109,3345,192.168.227.101,22,ssh
192.168.227.233,123,192.168.227.101,445,smb
192.168.227.233,123,192.168.227.101,445,smb
192.168.227.233,111,192.168.227.101,445,smb
192.168.227.202,123,192.168.227.101,3302,smtp
192.168.227.202,233,192.168.227.101,3302,smtp
192.168.227.102,123,192.168.227.101,3302,smtp
192.168.227.102,123,192.168.227.101,25,sql
192.168.227.102,123,192.168.227.101,25,sql
This is happening because generated gadgets are deciding the the color scale and domain dynamically based on the data that has been passed to chart.
If you want to explicitly specify the color domain and color scale you can configure those in generated gadgets by modifying the VizGrammar (which is the chart library used) configuration of the charts.
This can be done by changing chart api js file, there will be a config creation like this [1] and there add colorDomain for you predefined options like below. Then the domain will be defined statically without dynamically changing the order and the colors has to be constant
conf.colorDomain = ["MySQL","SMB","OTHER"]
Even you can define your own colors to
[1] https://github.com/wso2/carbon-analytics-common/blob/master/features/analytics-gadget-templates/org.wso2.carbon.analytics.gadget.chart.template.feature/src/main/charts/line-chart/api.js#L116

App Store and iTunes API: Getting icon

I am using request like this:
http://ax.itunes.apple.com/WebObjects/MZStoreServices.woa/wa/wsLookup?country=ru&id=
It shows information about the app from the Apple App Store but I have some problems with icons.
If i'm getting property artworkUrl60 it is too small 60x60 image, but it is rounder.
And with artworkUrl100 I'm geting 512x512 image that is too big, not rounded and looks ugly when I'm sizing it down to 100x100.
How can I can get nice looking rounded 100x100 image?
You must get artworkUrl512 and then replace ".png" or ".jpg" with specific size ".100x100-75.png" or ".100x100-75.jpg"
See also list all available image formats (png / jpg):
42x42-50
53x53-50
60x60-50
72x72-65
75x75-65
29x29-75
53x53-75
58x58-75
64x64-75
84x84-75
100x100-75
114x114-75
128x128-75
150x150-75
170x170-75
175x175-75
200x200-75
256x256-75
340x340-75
350x350-75
512x512-75
https://itunes.apple.com/lookup?id=1036264023
As per documentation in iTunes Search API :
https://affiliate.itunes.apple.com/resources/documentation/itunes-store-web-service-search-api/
I use JQuery and add the ui-corner-all class to images to make them have rounded corners. This works for any size image.