RGraph: What is causing my pie chart to disappear on-click? (#rgraph) - charts

I'm using the new RGraph beta release, and I can't figure out why this pie chart disappears when you click elsewhere on the page. Here is a screen cast of it happening: http://screencast.com/t/zPRhMqnCKk8.
self.pieChart = new RGraph.Pie('pie_'+self.id,progress)
.Set('shadow', true)
.Set('shadow.color', '#aaa')
.Set('labels',[]) // No labels
.Set('centerx', 50)
.Set('center50', Math.round(h/2))
.Set('radius',Math.round(h/2)-5)
.Set('key',labels)
.Set('key.position.gutter.boxed',false)
.Set('key.position.graph.boxed',false)
.Set('key.position.x',w-140)
.Set('key.position.y',5)
.Set('key.color.shape','circle')
.Set('text.size',8)
.Set('text.color','#555')
.Draw();
I have other charts on the page, and none of them do this. Maybe there is a way to disable click event listeners via Set()?
UPDATE
Richard, the author of RGraph, explained the issue perfectly in his comment. After removing RGraph.common.dynamic.js, my issue was resolved. However, if you need to use dynamic features, this solution may not work for you.

Looks like the Pie chart is being removed from the RGraph ObjectRegistry - which is where objects are held so that they can be redrawn when necessary.
If you don't use dynamic feature you could try excluding RGraph.common.dynamic.js and redraws won't happen when the page is clicked.

Related

How to programmatically make a TreeView visible

I'm trying to make a TreeView visible programmatically. The TreeView is empty.
I tried to call TreeView.reveal with a dummy TreeNode but it remains not visible.
The only other method available on TreeView is "dispose".
I don't see how I can have access to the "container" of this treeview as it is created using vscode.window.createTreeView(...).
I searched on vscode.window API but not found anything related to my purpose.
How can I reveal/make the TreeView visible programmatically?
fakeNode = new TreeNode("dummyType", "dummyLabel", "dummyStatus", vscode.TreeItemCollapsibleState.Expanded);
myTreeView.reveal(fakeNode);
expect(myTreeView.visible).to.be.true
it is currently not possible.
See https://github.com/microsoft/vscode/issues/90005 for a feature request. You can upvote the github issue to increase the probability to have it possible one day.

Does echarts has drill down option for all category of charts

I am going to use baidu echarts in my project, but till now not able to find drill down option in pie, bar and line charts.
Please help me, if anyone know the drill down option.
Simply use an onClick-handler for the chart- and this handler then changes the content of the chart. At least this is what i am using.
chart.on("click", (param) => {
// Magic here
});
But to answer your question: No, it does not have a drill down option for all chart types.
I managed to implement drill down with ajax calls, using the click event on the chart and it's parameters.
With the response you can init the chart and reload the options.

JavaFX TableColumns' headers not aligned with cells due to vertical scrollbar

after having spent the last few hours searching the web for this issue I decided that I need your help.
The issue is similar to this topic: Javafx: Tableview header is not aligned with rows
No answer has been provided there and also, I think, my case is slightly different:
I have a properly setup TableView with reused CellFactories and CellValueFactories. Data-wise, everything works 100% the way I intended. However once I populated my table with more rows than my view can show it naturally started to show a vertical scrollbar. From that moment on (see first screenshot) the column headers weren't aligned with the columns anymore. It appears that it is exactly the width of the scrollbar that distorted the widths distribution (I'm using ConstraintResizePolicy with a few fixed width columns and the rest relying on computed width, again, otherwise working flawlessly).
As soon as I scroll with the mouse wheel, click on an entry, tab into focus or resize the window/view, the headers snap into place (see second screenshot).
Based on the topic posted in the beginning, I think this is a bug and I'm therefore not only looking for a solution (which might not exist) but also for a workaround. I tried:
table.scrollTo()
table.scrollToColumnIndex()
table.layout()
table.requestFocus()
table.requestLayout()
table.refresh()
I know not all of those make sense but still I tried and none of them made the column headers be in line with their columns on application launch.
Every suggestion is welcomed.
I don't feel that sharing code helps here, but ask if you want something specific. The view was built with SceneBuilder 8 and consists of an AnchorPane, a TableView in the middle, and 6 TableColumns, nothing else.
Thank you very much!
I've had the same problem. It seems a bug. Try this. It works for me
Platform.runLater(() -> tableView.refresh());
I know this is an old message but I tried everything to get the headers aligned and nothing was working until I stepped away from the problem. I then tried this and it worked. Headers jump but I am ok with that. I hope this helps someone else.
Task<Boolean> task = new Task<Boolean>() {
#Override protected Boolean call() throws Exception {
Thread.sleep(300) // needs this to make sure the table is displayed
table.refresh();
table.scrollTo(0);
return true;
}
};
new Thread(task).start();
I also have the situation of TableColumns' Headers not aligend with cells.But I am not because Scrollbar.I am because of setting a border color for cells.After the CSS modified, I got the correct result.
Incorrect CSS:
.table-row-cell {
-fx-border-color: black;
}
changed to:
.table-row-cell {
-fx-table-cell-border-color: black;
}
Reference documentation: https://community.oracle.com/tech/developers/discussion/2505963/tableview-column-headers-do-not-line-up-with-rows
None of the other solutions worked for me. I noticed that the issue only occurs when the horizontal scrollbar is on the far right and then the table is cleared (table.getItems().clear()) while other content changes didn't cause the bug even if the scrollbar disappears and reappears.
I checked this bug report https://bugs.openjdk.java.net/browse/JDK-8149615 (and the linked changeset) and at first dismissed the workaround because scrolling to the first column (table.scrollToColumnIndex(0)) wasn't working for me either.
But it started working once I called scrollToColumnIndex before clearing the table with getItems().clear().
The bug report suggests reacting to the visibility change of the placeholder node. I didn't test this because I had already solved it (hopefully) and no sample code is provided. But if I ever need to revisit this I would try writing a listener for the placeholder visibility as an alternative solution.

How can I get g-leaflet map to show immediately and without having to resize the window?

I have a problem with g-leaflet - it shows as a grey rectangle only (with a bit of the map at top left) until I resize the window (manually). Then it shows up. Sometimes parts of maps show when I hover over an area but this too is incomplete and problematic. Here:
The code that I use to add the G-Leaflet map to my GXT VerticalContainer (com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer) is as follows, taken from G-Leaflet example:
LeafletDrawResourceInjector.ensureInjected();
final MapWidget mapWidget = new MapWidget();
mapWidget.setSize("1000px", "750px"); // I added this myself to try to fix the issue
myVerticalLayout.add(mapWidget);
(I also set the size of the "myVerticalLayout" container).
Please help!
Leaflet is really finicky. Scheduling a defferred call to invalidateSize() was not enough. Had to make my own JavaScript call to its invalidateSize using setTimeout, also making sure that all the containers are attached before this happens. Only hen it would show.

JFreeChart charts appearance when combined with JasperReports

I use JFreeChart in my java application to display charts like this one:
But after creating a report with JasperReports that chart now looks like this:
And that's not all, this is how a chart looks like inside the first PDF report generated with the app:
And this is how it looks when I generate a second report, without changing anything, just generating it again:
This happens again and again, everytime I restart the application. Charts are ok until I create a report. What's happening?
It looks like JasperReports is using a more prosaic BarPainter in it's ChartTheme, probably to accommodate destinations that handle gradients poorly.
This forum thread suggests applying the desired theme directly to the chart. The createLegacyTheme() method "returns a ChartTheme that doesn't apply any changes to the JFreeChart defaults. It, or something similar, might be worth a try:
StandardChartTheme.createLegacyTheme().apply(chart)
I've moved the edits here as an answer:
The theme problem
Thanks to #trashgod I've tried the following line:
ChartFactory.setChartTheme(StandardChartTheme.createJFreeTheme());
If I use this line before creating charts in my application, reports no longer affect the appearance of them. I think it is enough to put this line just once after report creation.
So now I just have one problem: the first report is different from subsequent reports: charts are different, fonts are bolder and not antialiased...
The Problem of the second report
The pdf issue is not caused by jasper reports nor jfreechart. It is a problem of Adobe Reader. This happens when you have more than one instance of Adobe Reader running (for example, when you have two different files opened).
An example of the problem:
Similar issues:
http://forums.adobe.com/message/4192938
http://forums.adobe.com/thread/902298