qwtPlot::print function not available in qwt-6.1.2 - qpixmap

I tried to export the current graph into a pixmap image. i checked some implementation using
QwtPlotPrintFilter
QwtPlotPrintFilter filter;
int options = QwtPlotPrintFilter::PrintAll;
d_plot->print(pixmap, filter);
but im not able to find QwtPlot::Print( function or QwtPlotPrintFilter. is there any alternate functinality available or problem with version i downloaded.
or i have to use QwtPlotRenderer ?

Related

Programmatically update the signal for a multi-click in vega/vega-lite

Following the example on the website: https://vega.github.io/editor/#/examples/vega-lite/interactive_bar_select_highlight
I want to programmatically set the selections via signals. I realize that I could emulate a click by doing the following
VEGA_DEBUG.view.signal("select_tuple", {"unit":"","fields":[{"type":"E","field":"_vgsid_"}],"values":[1]})
However, I cannot proceed to select another, e.g., the shift select of the 2
VEGA_DEBUG.view.signal("select_tuple", {"unit":"","fields":[{"type":"E","field":"_vgsid_"}],"values":[2]})
This makes sense, since only shift-click accumulates the state.
I tried modifying the accumulated signal
VEGA_DEBUG.view.signal("select", {"_vgsid_":[1,2],"vlMulti":{"or":[{"_vgsid_":1},{"_vgsid_":2}]}})
However, this does not help. Is this not possible? I understand that a custom solution may be possible in hand-rolled vega, as opposed to that compiled from vega-lite.
Thanks.
Just need to set VEGA_DEBUG.view.signal("select_toggle", true) before adding the new select!!
After much research I made this example of how to change the vega-lite brush programmatically
https://observablehq.com/#john-guerra/update-vega-lite-brush-programmatically
Using #koaning example this stack overflow question I figured that you can change the brush by updating "brush_y" (assuming that your selection is called brush) or change the selection using "brush_tuple" (which doesn't seem to update the brush mark)
viewof chart = {
const brush = vl.selectInterval("brush").encodings("y");
const base = vl
.markBar()
.select(brush)
.encode(
vl.x().count(),
vl.y().fieldQ("Horsepower"),
vl.color().if(brush, vl.value("steelblue")).value("gray")
)
.height(maxY);
return base.data(data).render();
}
update = {
// From https://codepen.io/keckelt/pen/bGNQPYq?editors=1111
// brush_y -> brush_tuple -> brush
// Updates on pixels
chart.signal("brush_y", [by0, maxY / 2]);
await chart.runAsync();
}
Crossposting here in case it might be useful for anyone

ArcGIS 3.28, clear() except specific graphics

In ArcGIS 3.28, I need to use clear() but exclude some graphics, is there a method to do this? I don't want to remove all the graphics on a layer
Well, ArcGIS JS API provides two way to remove the graphics:
clear() click here for more details...
remove(graphic) click here for more details...
In both the cases there is no provision to provide remove condition so I don't think you can directly remove the the feature base on certain condition.
However still if you need to achieve this below is the same for it-
var graphicsList = layerObj.graphics;
for (i = 0; i < graphicsList.length; i++) {
if(remove_conditions){
layerObj.remove(graphicsList[i]);
i--;
}
}
Hoping above sample will help you to achieve the same.

Is there a way to apply an alpha mask to a FlxCamera?

I'm trying to implement this camera but one of the obstacles I'm facing right now, is the merging of two cameras (what he describes here).
At first I tried to make a non-rectangular camera, but I don't think it's possible without changing a lot of things in the way HaxeFlixel renders.
And then I found the alphaMask() function in the FlxSpriteUtil package and I think it would be a better solution.
Not only would it solve my problem, it would actually permit all kinds of funky-shaped cameras, you just have to create the right mask!
But the new problem is that I don't know how to (and again, if it's possible without changing a bit the FlxCamera) apply it to the camera.
Internally, the FlxCamera might use a FlxSprite, but only in blit render mode, and I am in tiles render mode (haven't found how to change, not good enough solution in my opinion), which uses a Flash Sprite instead and I don't know what to do with it.
So in short, do you have an idea how to apply an AlphaMask to a FlxCamera? Or another way to achieve what I'm trying to do?
PS: If you want to have a look at the (ugly and frenchly commented) code, it's over here!
You can render the contents of a FlxCamera to a FlxSprite (though it does require conditional code based on the render mode). The TurnBasedRPG tutorial game uses this for the wave effect in the combat screen, see CombatHUD.hx:
if (FlxG.renderBlit)
screenPixels.copyPixels(FlxG.camera.buffer, FlxG.camera.buffer.rect, new Point());
else
screenPixels.draw(FlxG.camera.canvas, new Matrix(1, 0, 0, 1, 0, 0));
Here's a code example that uses this to create a HaxeFlixel-shaped camera:
package;
import flixel.tweens.FlxTween;
import flash.geom.Matrix;
import flixel.FlxCamera;
import flixel.FlxG;
import flixel.FlxSprite;
import flixel.FlxState;
import flixel.graphics.FlxGraphic;
import flixel.system.FlxAssets;
import flixel.util.FlxColor;
import openfl.geom.Point;
using flixel.util.FlxSpriteUtil;
class PlayState extends FlxState
{
static inline var CAMERA_SIZE = 100;
var maskedCamera:FlxCamera;
var cameraSprite:FlxSprite;
var mask:FlxSprite;
override public function create():Void
{
super.create();
maskedCamera = new FlxCamera(0, 0, CAMERA_SIZE, CAMERA_SIZE);
maskedCamera.bgColor = FlxColor.WHITE;
maskedCamera.scroll.x = 50;
FlxG.cameras.add(maskedCamera);
// this is a bit of a hack - we need this camera to be rendered so we can copy the content
// onto the sprite, but we don't want to actually *see* it, so just move it off-screen
maskedCamera.x = FlxG.width;
cameraSprite = new FlxSprite();
cameraSprite.makeGraphic(CAMERA_SIZE, CAMERA_SIZE, FlxColor.WHITE, true);
cameraSprite.x = 50;
cameraSprite.y = 100;
cameraSprite.cameras = [FlxG.camera];
add(cameraSprite);
mask = new FlxSprite(FlxGraphic.fromClass(GraphicLogo));
var redSquare = new FlxSprite(0, 25);
redSquare.makeGraphic(50, 50, FlxColor.RED);
add(redSquare);
FlxTween.tween(redSquare, {x: 150}, 1, {type: FlxTween.PINGPONG});
}
override public function update(elapsed:Float):Void
{
super.update(elapsed);
var pixels = cameraSprite.pixels;
if (FlxG.renderBlit)
pixels.copyPixels(maskedCamera.buffer, maskedCamera.buffer.rect, new Point());
else
pixels.draw(maskedCamera.canvas);
cameraSprite.alphaMaskFlxSprite(mask, cameraSprite);
}
}

Create FullPage Screenshot WebDriver

Does someone knows a way to create full page screenshots using WebDriver?
I want if one of my tests fails to create a FULL PAGE (even the not visible part on the screen) screenshot before the browser close and save it on share location.
Also, if it is possible I want to output the result to Jenkins Console log.
Thanks!
You can use the following extension for Firefox: https://addons.mozilla.org/nl/firefox/addon/fireshot/
You can find its javascript code in %APPDATA%\Mozilla\Firefox\Profiles\
The extensions provide the ability to copy the screenshot to the clipboard.
You can use its JS methods to perform the screenshot. After that, you can retrieve the image from the clipboard and save it to as a file on shared location.
Image image = default(Image);
if (Clipboard.GetDataObject() != null)
{
IDataObject data = Clipboard.GetDataObject();
if (data.GetDataPresent(DataFormats.Bitmap))
{
Image image = (Image)data.GetData(DataFormats.Bitmap,true);
image.Save("image.jpg",System.Drawing.Imaging.ImageFormat.Jpeg);
}
else
{
Console.WriteLine("The Data In Clipboard is not as image format");
}
}
else
{
Console.WriteLine("The Clipboard was empty");
}
string newImageName = string.Concat(#"C:\SampleSharedFolder\", Guid.NewGuid());
image.Save(newImageName );
Console.WriteLine("Image save location: {0}", newImageName);
Once you have populated the result to Console it is really easy to output it back to Jenkins. You can find more in my article: http://automatetheplanet.com/output-mstest-tests-logs-jenkins-console-log/
You can use Snagit to perform full page screenshots. More information here: https://www.techsmith.com/tutorial-snagit-documentation.html
First you need to start the Snagit server and then follow the documentation.

How to develop a JIRA plugin that display charts?

I am a newbie in JIRA World, my mission is to develop a JIRA plugin that display charts (pies, histogram, etc.). The user would choose the criteria of search and the type of charts,
and the user should be able to save those charts (Word/PDF).
I don't know if I should develop a report plugin and use JFreeChart for charting or develop a charting plugin (I haven't seen any example of charting plugin). I have done some research about report plugin and I haven't found an example show how to Use JFreechart!! also I haven't found any example show how to use jasperReport (or another tool) to generate word or PDF report.
The user should access to the plugin from a tab like interface (administration, home, etc.)
Example of KPI (key performance indicator) to display:
Average of time spent to reslove an issue
Number of issues that still open
PS: I'm using JIRA 4.3.3
There is a JIRA plugin to export charts to Word, which covers part of what you wanted to do.
https://marketplace.atlassian.com/plugins/com.clariostechnology.officecharts.officecharts
Also see Intelligent Reporter which gives more options for formatting charts and allows you to use Word files as templates and fill in the charts and other data.
https://marketplace.atlassian.com/plugins/com.clariostechnology.intelligentreports
Try reading the article Creating a pie chart in JIRA from the great book "JIRA 5.x Development Cookbook" by Jobin Kuruvilla.
The most important thing is to populate your dataset, which will be used to generate the needed chart. Consider the example from that book, which shows the java side of that plugin:
public Chart generateChart(JiraAuthenticationContext authenticationContext, int width, int height) {
try {
final Map<String, Object> params = new HashMap<String, Object>();
// Create Dataset
DefaultPieDataset dataset = new DefaultPieDataset();
dataset.setValue("One", 10L);
dataset.setValue("Two", 15L);
final ChartHelper helper = new PieChartGenerator(dataset, authenticationContext.getI18nHelper()).generateChart();
helper.generate(width, height);
params.put("chart", helper.getLocation());
params.put("chartDataset", dataset);
params.put("imagemap", helper.getImageMap());
params.put("imagemapName", helper.getImageMapName());
params.put("width", width);
params.put("height", height);
return new Chart(helper.getLocation(), helper.getImageMap(), helper.getImageMapName(), params);
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("Error generating chart", e);
}
}
and the velocity template for such purpose:
#if ($chart)
#if ($imagemap)
$imagemap
#end
<p class="report-chart">
<img src='$baseurl/charts?filename=$chart' border='0' #if ($imagemap) usemap="\#$imagemapName" #end/>
</p>
#end
That's it in the most basic example. But also, take a look at the ChartFactory and ChartUtils interfaces, to get the deeper idea how to create various types of charts.
You don't need to write a plugin to do that-these are native capabilities in JIRA. If you're hellbent on writing a plugin I'd use JFreeChart. See the JIRA Charting Plugin and JQL filters to get your two listed KPIs.
in velocity:
#set($cht = $chart)
#if ($cht)
#if ($cht.imageMap)
$cht.imageMap
#end
<p class="report-chart">
<img src='$baseurl/charts?filename=$chart.location' border='0'
#if ($cht.imageMap) usemap="\#$cht.imageMapName" #end/>
</p>
#end
webwork:
#SuppressWarnings("unused")
public Chart getChart() {
JiraAuthenticationContext authenticationContext = ComponentAccessor.getJiraAuthenticationContext();
final int CHART_WIDTH = 300;
final int CHART_HEIGHT = 300;
try {
final Map<String, Object> params = new HashMap<String, Object>();
// Create Dataset
DefaultPieDataset dataset = new DefaultPieDataset();
dataset.setValue("One", 10L);
dataset.setValue("Two", 15L);
final I18nBean i18nBean = new I18nBean(authenticationContext.getUser().getDirectoryUser());
final ChartHelper helper = new PieChartGenerator(dataset, i18nBean).generateChart();
helper.generate(CHART_WIDTH, CHART_HEIGHT);
params.put("chart", helper.getLocation());
params.put("chartDataset", dataset);
params.put("imagemap", helper.getImageMap());
params.put("imagemapName", helper.getImageMapName());
params.put("width", CHART_WIDTH);
params.put("height", CHART_HEIGHT);
Chart ch = new Chart(helper.getLocation(), helper.getImageMapHtml(), helper.getImageMapName(), params);
return ch;
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("Error generating chart", e);
}
}
result:
The best alternative to save your time from plugin programming, yet giving you incredible features and flexibility, is generating the charts in Excel via exporting JIRA data with the Better Excel Plugin.
How does it work?
You create a template XLSX file with special placeholder, tags for the actual data.
Define so-called named ranges and generate (empty) charts from them, using all the charting features in Excel. (As MS Excel is still the most versatile and most widely used data visualization tool, it is almost guaranteed that your use case will be supported and you will find tons of help by Googling the web.)
When you export this template, the add-on will fill the named range with your issues' data and the chart "wakes up"!
The end-result may look like this (in its own worksheet):
See this tutorial about drawing various types of charts to visualize JIRA data: http://www.midori.hu/products/jira-pdf-view-plugin/documentation/charts
The technique explained there relies on capturing your custom KPI calculation logic in concise Groovy scripts, rendering the charts with the de-facto standard JFreeChart, all backed by our JIRA PDF View Plugin.
(Discl: the plugin mentioned there is our commercially supported software.)