WSO2: Dashboard Issues and Personalization - legend

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

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

How to generate a wavesurfer with multiple peak colors using videojs-wavesurfer or wavesurfer.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/#/

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

pine script with two indicators one overlaid on the chart and another on its own?

I am trying to write a pine script with two indicators one overlaid on the chart (EMA) and another on its own?(Stoch) I cannot seem to find any info on how to separate these (Visually) but keep them within 1 pine script, ie to be able to take trading decisions based on these.
The earlier answer from Luc is right, unfortunately. Each script can either create plots that are overlaid on the default price chart, or shown in a different pane, but not both. But there is a workaround.
Suppose you've made some non-trivial calculation in your script and you'd like to put it in different pane. E.g. the next code:
//#version=4
study(title="Stochastic", shorttitle="Stoch", format=format.price, precision=2)
periodK = input(14, title="K", minval=1)
periodD = input(3, title="D", minval=1)
smoothK = input(3, title="Smooth", minval=1)
k = sma(stoch(close, high, low, periodK), smoothK)
d = sma(k, periodD)
plot(k, title="%K", color=color.blue)
plot(d, title="%D", color=color.orange)
h0 = hline(80)
h1 = hline(20)
fill(h0, h1, color=color.purple, transp=75)
// This next plot would work best in a separate pane
someNonTrivialCalculatedSeries = close
plot(ema(someNonTrivialCalculatedSeries, 25), title="Exporting Plot")
Because they have different scale, one of them most likely will break another indicator's scale.
So you'd like show Stoch in different pine, whereas ema() should be overlayed with the main chart. For that you should make the next steps:
Turn off in the study's the extra plot to return scale to normal:
Apply to the chart the next script:
//#version=4
study("NonOverlayIndicator", overlay=true)
src = input(defval=close, type=input.source)
plot(src)
Choose in the second's script inputs source required plot from the first script:
And voilĂ  - you got the plots in different pines:
But if you want split the plots because you have retrictions on amount of studies you allowed to apply (e.g. 3 for free-account) - that won't help you.
It cannot be done. A script runs either in overlay=true mode on the chart, in which case it cannot direct plots elsewhere, or in a separate pane when overlay=false (the default).
When the script is running in a pane, it can change the color of the chart bars using barcolor(), but that's the only way it can modify the chart.
It is possible to rescale signals so that multiple bounded (e.g., 0-100, -1 to +1) signals generated by one script appear one on top of the other, but this is typically impossible in overlay mode, as the vertical scale varies with the bars on the chart. The only way for an overlay script to work with its own scale is when it uses No scale, but this prevents the indicator's plots to plot relative to price, and so the chart's bars.
Nice workaround from Michael.
Unfortunately, this only seems to work to pass data for one plot.
I would like to pass data for 3 different plots to the stock price graph.
If I try this, for 'input.source' I can only select the standard sources: "open, high, low, close ...". I can not select the data from other indicators.
If I remove plots 2 and 3, it works as Michael described.
Anybody has a workaround for the workaround..? ;-)

How to add secondary Y-axis in RadCartesianChart windows store apps

we are developing an windows 8 store apps and telerik charts to display charts. In one of the charts we need to show the chart having 2 y-axis and bar series need to bind to left side of the y-axis and line series need to bind data to right side of the y-axis(secondary y-axis). So i posted in one of the forum and got reply form them and i like to share the answer.
Here is the solution I suggest. You have to create a class that inherits the Collection class in your project.
public class CustomAxes : Collection<Axis> { }
This will make it possible to define custom collection of axes that will be used by the corresponding series. Next you have to create CustomAxes object in the resources of your application and fill it with the axes you want to have in your chart:
<local:CustomAxes x:Key="customAxes">
<telerik:LinearAxis HorizontalLocation="Left"/>
<telerik:LinearAxis HorizontalLocation="Right"/>
</local:CustomAxes>
Now you have to bind the vertical axes of your series to the custom axes:
<telerik:BarSeries VerticalAxis="{Binding Source={StaticResource customAxes}, Path=[0]}">
Here is the sample code attached in this forum.