cuba-platform / charts Goto Github PK
View Code? Open in Web Editor NEWCharts and Maps Addon
Home Page: https://www.cuba-platform.com/
License: Apache License 2.0
Charts and Maps Addon
Home Page: https://www.cuba-platform.com/
License: Apache License 2.0
Marker#setPosition doesn't update location on the MapView
Original issue: https://youtrack.haulmont.com/issue/PL-6718
====Changes====
All charts have renderingDelay attribute except stockChart;
renderingDelay - sets rendering delay in which the chart should be rendered (renders instantly if not set). The delay is time in ms.
[AmCharts doc link|https://docs.amcharts.com/3/javascriptcharts/AmCharts#makeChart]
Usage exmaple:
XML
<chart:pieChart id="pieChart"
renderingDelay="1000.25">
Java
pieChart.setRenderingDelay(1000.25); // takes Double value;
pieChart.getRenderingDelay();
🔗 Related links: {"relates to:": "https://youtrack.haulmont.com/issue/PL-9969", "causes:": "https://youtrack.haulmont.com/issue/PL-10539"}
Original issue: https://youtrack.haulmont.com/issue/PL-10294
User session log is not updated when REST API token is revoked
Original issue: https://youtrack.haulmont.com/issue/PL-10086
For instance use non-existing field in "categoryField" attribute of serial chart. InternalError will be produced
Original issue: https://youtrack.haulmont.com/issue/PL-10297
We can get rid of duplication in charts.xsd using xmlns reference on window.xsd.
Example:
<xs:schema targetNamespace="http://strangeway.org/xsd/responsive/responsive.xsd"
xmlns:cuba="http://schemas.haulmont.com/cuba/window.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://strangeway.org/xsd/responsive/responsive.xsd"
elementFormDefault="qualified">
<xs:complexType name="responsiveColumnType">
<xs:complexContent>
<xs:extension base="cuba:baseComponent">
<xs:sequence>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:group ref="cuba:layoutOrComponent"/>
</xs:choice>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:schema>
Remove deprecated charts DataItem classes
Original issue: https://youtrack.haulmont.com/issue/PL-10172
Circle#setVisible doesn't affect visibility
Original issue: https://youtrack.haulmont.com/issue/PL-6720
Очень хотелось бы иметь на панели для рисования на карте кнопочку с возможностью установки маркера. Это удобно, например, если нужно на уже нарисованных объектах отметить какую-то точку, поскольку сейчас это можно сделать либо установкой маркера заранее, либо поставить маркер где-либо, а затем передвинуть в интересующее место.
Original issue: https://youtrack.haulmont.com/issue/PL-7867
Проблема в том, что когда имплементируешь MapViewer#addMapClickListener с возможностью добавлять маркер на карту маркер не отрисовывается до момента, пока не подвигаешь курсором.
Пример как был заимплементирован листенер:
{code:lang=java|title=Code}
mvZoneMap.addMapClickListener(new MapClickListener() {
@OverRide
public void onClick(MapClickEvent event) {
if (mZoneLocation != null)
mvZoneMap.removeMarker(mZoneLocation);
gpZoneLocation = event.getPosition();
mZoneLocation = mvZoneMap.createMarker("Zone center", gpZoneLocation, true);
mvZoneMap.addMarker(mZoneLocation);
}
});
---
Original issue: https://youtrack.haulmont.com/issue/PL-7866
Now we cannot set simple caption
attribute supported by all Vaadin components
Currently, only fields have JavaDocs.
Example:
ContextMenu ctxMenu = googleMap.createContextMenu();
ctxMenu.addAction(actionCaption, event -> {
// action code
});
googleMap.setMarkersContextMenu(ctxMenu);
Original issue: https://youtrack.haulmont.com/issue/PL-9079
Check that charts still correctly work
Make sure that the project can be successfully created and started and when it has a web-toolkit
module, and when it does not have it.
Relates to cuba-platform/cuba#542
Options:
Due to GoogleMaps license limitations we need additional Map component that can be used in internal ERPs for free / cheaper than Google
Original issue: https://youtrack.haulmont.com/issue/PL-10419
Add ability to prevent zooming while data updates for charts
Original issue: https://youtrack.haulmont.com/issue/PL-8998
Generic map layers for entities with position (markers) and entities with regions (polygons) bound to datasources
Original issue: https://youtrack.haulmont.com/issue/PL-6308
See Warlord implementation for details (by @tinhol )
Using new Action - ShowPivotAction
you can export data from components that extends ListComponent
class to the PivotTable
component.
ShowPivotAction has several modes for export: all rows and selected rows. You don't have to select it, because it depends on selected rows.
All rows will be exported by default without confirmation dialog if you didn't select rows.
A confirmation dialog will be shown If you select some rows and click on a button with action:
The PivotTable
component will be shown in a new tab with editable = true
by default.
In the opened tab, PivotTable
has an extension that allows you to export pivot data to excel (if the current renderer is supported).
Note, if property has any type from following list:
To create action, you should send component that extends ListComponent
class as a parameter. Also, you can send an action id otherwise default id will be used.
ShowPivotAction action = ShowPivotAction.create(table);
//or
ShowPivotAction action = ShowPivotAction.create(table, "actionId");
By default ShowPivotAction
send all properties that defined in the View
of CollectionDatasource
. If you want to send certain properties or exclude, you can use the following methods:
withIncludedProperties() // received List<String> of properties name;
withExcludedProperties() // received List<String> of properties name;
As ShowPivotAction
has a fluent API, you can use following code entry:
ShowPivotAction action = ShowPivotAction.create(table)
.withIncludedProperties(Arrays.asList("login", "name", "active", "group", "position"))
.withExcludedProperties(Arrays.asList("name", "position"));
The order of methods doesn't matter:
In the above example, the result of applied properties is: ("login", "active", "group")
If we change the order of invoked methods:
ShowPivotAction action = ShowPivotAction.create(table)
.withExcludedProperties(Arrays.asList("name", "position"))
.withIncludedProperties(Arrays.asList("login", "name", "active", "group", "position"));
The result of applied properties will be: ("login", "active", "group").
All incorrect properties are ignored.
To configure pivot table, you must use the following method:
withNativeJson() // received String json;
JSON structure for a non-editable pivot table:
{
"cols": ["localized property", "localized property"],
"rows": ["localized property"],
"editable": false,
"renderer": "heatmap",
"aggregation": {
"id": "d8fc3fdf-730d-c94f-a0c8-72a9ce3dcb3a",
"mode": "sumOverSum",
"properties": ["localized property", "localized property"]
}
}
JSON structure for editable pivot table:
{
"cols": ["localized property"],
"rows": ["localized property"],
"editable": true,
"renderers": {
"selectedRenderer": "barChart"
},
"autoSortUnusedProperties": true,
"aggregationProperties": ["localized property", "localized property"],
"aggregations": {
"selectedAggregation": "count",
"aggregations": [{
"id": "647780f0-c6d0-6ade-a63a-542b5c8cdbd5",
"mode": "count",
"caption": "Count"
}, {
"id": "c2663238-2654-67f0-2dec-add6962d867c",
"mode": "sumOverSum"
}]
}
}
For more information about configuration properties see https://github.com/nicolaskruchten/pivottable/wiki/Parameters
For non-persistent Entity (e.g. TipInfo)
Without and with view:
a) without "include" and "exclude" properties - should show all available properties
b) using withIncludedProperties()
- should show only included
c) using withExcludedProperties()
- should show available properties minus excluded
d) using both methods - excluded properties will be applied to included. If count of result properties is zero - all available properties will be shown.
For peristent Entity (e.g. User)
Without and with view
a - d) same steps
e) Check security for properties
f) Check uuid property
g) Check byte array property
h) Try to use in withIncludedProperties()
propertyPath (e.g. group.name)
At the moment web contains all the code including UI components and Spring beans. Let's move Vaadin UI components to the separate web-widgets module as it is done for cuba.
At the moment the only way to do it is to override the whole datatypes.xml file.
OR
Probably it will be enough just to have timezone information in he default datetime format.
Original issue: https://youtrack.haulmont.com/issue/PL-9674
When I trying delete programmaticaly polygon overlay (i.e. if polygon is not valid) from MapViewer using method MapViewer#removePolygonOverlay nothing changes.
For example a piece of code
private PolygonCompleteListener polygonComplete = event -> {
PolygonDelegate pd = (PolygonDelegate) event.getPolygon();
if (!mvHelper.isValid(pd)) {
showNotification(
"Polygon draw warning",
"Polygon topology incorrect. Discard drawing",
NotificationType.ERROR
);
mvZoneMap.removePolygonOverlay(event.getPolygon());
}
}
Original issue: https://youtrack.haulmont.com/issue/PL-8246
MapViewver zoom has type int, but MapMoveListener.MapMoveEvent#getZoom is double. Unify zoom type.
Original issue: https://youtrack.haulmont.com/issue/PL-6717
For instance, isDoubleClick
Added:
barmode: 'relative'
for best Plotly bar-stacking behaviourshowUI
parameter in pivotUI()
to hide UI and paper over differences between pivot()
and pivotUI()
rowTotals
and colTotals
options for table renderersNew properties:
showRowTotals
- options for row with total values (true by default);showColTotals
- options for column with total values (true by default);showUI
- it can be used only with editable PivotTable
and can hide or show UI elementes (true by default).showRowTotals
and showColTotals
properties work only with table-renderers (heatmap, table, etc).
...
<chart:pivotTable id="tipsPivotTable"
datasource="tipsDs"
showRowTotals="false"
showColTotals="false"
renderer="HEATMAP">
...
<chart:pivotTable id="tipsPivotTableUI"
showUI="false"
datasource="tipsDs"
editable="true">
...
tipsPivotTable.setShowColTotals(false);
tipsPivotTable.isColTotalsShown();
tipsPivotTable.setShowRowTotals(false);
tipsPivotTable.isRowTotalsShown();
tipsPivotTableUI.setShowUI(false);
tipsPivotTableUI.isShowUI();
{
"rendererOptions": {
"table": {
"rowTotals": false,
"colTotals": false
}
}
}
{
"showUI": false
}
Expected result: !expected.bmp!
Actual result: !actual.bmp!
Original issue: https://youtrack.haulmont.com/issue/PL-10084
private void redraw() {
map.clearMarkers();
...
}
Original issue: https://youtrack.haulmont.com/issue/PL-4986
pivotTable
<chart:pivotTable id="pivotTable"
datasource="clientsPivotDs"
height="300px"
width="100%">
<chart:properties>
<chart:property name="title"/>
<chart:property name="rank"/>
<chart:property name="money"/>
</chart:properties>
</chart:pivotTable>
public class ClientBrowse extends AbstractLookup {
@Inject
private PivotTable pivotTable;
@Override
public void ready() {
super.ready();
pivotTable.setEditable(true);
}
public void onTestBtnClick() {
pivotTable.setEditable(true);
pivotTable.setRows(Collections.singletonList("money"));
pivotTable.setColumns(Collections.singletonList("rank"));
pivotTable.setAggregationProperties(Collections.singletonList("money"));
pivotTable.setRenderers(new Renderers());
pivotTable.getRenderers().setDefaultRenderer(Renderer.TABLE);
pivotTable.setAggregations(new Aggregations());
pivotTable.getAggregations().setDefaultAggregation(AggregationMode.SUM);
pivotTable.repaint();
}
Switch Pivot
buttonStrange thing happens: we receive RefreshEvent
from client side with incorrect aggregation and renderers back to server side after button click.
Demo project:
https://app.zenhub.com/files/131167043/98b13cdf-cc27-4600-93d8-33fdfb3941fb/download
Settings applied, renderer and aggregation is set after click
Settings are not applied on button click
At the moment there are many unnecessary object such as Point that must be created using an additional call
Replace them with lightweight (double, double) parameters
Try to find and simplify other problem methods / classes
Original issue: https://youtrack.haulmont.com/issue/PL-10295
After each marker drag action all non-draggable markers with custom icon are being visually re-added on map (with jumping animation)
Original issue: https://youtrack.haulmont.com/issue/PL-5543
...
<chart:properties>
<chart:property name="invoice.date"/>
</chart:properties>
...
Now map markers has unusual web resource root: app/web
Marker marker = map.createMarker("Test marker", coordinate, false);
marker.setIconUrl("VAADIN/pin.png");
map.addMarker(marker);
Original issue: https://youtrack.haulmont.com/issue/PL-6650
It will be great to have an ability to draw polygon with holes. For now it can be emulate artificially but not quite correct. Because holes don't looks as holes (look at the picture).
!Cuba-polygons.png!
So, holes are supported by Google Maps (see https://developers.google.com/maps/documentation/javascript/examples/polygon-hole)
Could you please add this feature?
Thank you
Original issue: https://youtrack.haulmont.com/issue/PL-8241
Related to cuba-platform/cuba-gradle-plugin#27
Current way of CSV copy-paste is very clumsy.
Created extension for PivotTable
component - PivotTableExtension
. It is not a component and can't be created in ComponentsFactory
.
Given extension provides API for downloading PivotTable with aggregated data to excel with *.xls
format.
Note, the extension works only for the following renderers types: "Table", "Table Barchart", "Heatmap", "Row Heatmap", "Col Heatmap". And doesn't get the color of cells.
In PivotTableExtension
interface we have two methods for downloading file:
void exportTableToXls();
void exportTableToXls(ExportDisplay display);
If it is neccessary to define file name we can use following method:
void setFileName(String fileName);
If file name is not defined it will use localized caption of entity in PivotTable
At the server side we can get JSON representation of PivotTable with data or serialized object (PivotData
):
String getPivotDataJSON();
PivotData getPivotData();
Note, if PivotTable contains more than 65536 rows (XLS doesn't support more rows) content will be cut by the last row and you will see a warning message.
In screen controller we should create an instance of extension. And, for example, create method save()
, that will be invoked from some button;
@Inject
private PivotTable pivotTable;
private PivotTableExtension extension;
@Override
public void init(Map<String, Object> params) {
extension = new WebPivotTableExtension(pivotTable);
}
public void save() {
extension.exportTableToXls();
}
XML:
<layout expand="pivotTable">
<button caption="download" invoke="save"/>
<chart:pivotTable id="pivotTable"
autoSortUnusedProperties="true"
datasource="tipsDs"
editable="true">
<chart:properties>
<chart:property name="row"/>
<chart:property name="totalBill"/>
<chart:property name="tip"/>
<chart:property name="sex"/>
<chart:property name="smoker"/>
<chart:property name="day"/>
<chart:property name="time"/>
<chart:property name="size"/>
</chart:properties>
. . .
</chart:pivotTable>
</layout>
Test cases:
WebGoogleMapViewer.addMarker(Marker)
assumes that the MarkerDelegate
is passed to the method.
Marker Listeners create a new MarkerDelegate
instance every time event is fired.
Original issue: https://youtrack.haulmont.com/issue/PL-10319
Minimal reproducible example
Expected behavior
A property is moved
Actual behavior
Drag'n'drop properties is disabled
See also: https://www.cuba-platform.com/discuss/t/touch-device-pivot-table/5903
public class ClientBrowse extends AbstractLookup {
@Inject
private PivotTable clientPivotTable;
public void switchMe() {
clientPivotTable.setEditable(!clientPivotTable.isEditable());
}
}
UI should change between editable and readonly representation.
UI is changed only if we use F5 key and refresh the page
Forum discussion link : https://www.cuba-platform.com/discuss/t/polyline-click-listener/5765
Add date format property for serialization and deserialization of Date object.
The main idea is to provide dateFormat
property to show formatted date in the PivotTable
cells.
For instance:
dateFormat="yyyy-MM-dd"
date in the cell: 2019-01-01
It would allow us to detect date property from the client side and handle it in the PivotExcelExporter
. So in the generated excel file, we will set "date format" style to cells with Date.
PivotTableExtension now available detect dateTime, date and time types and set corresponding format in the excel file. By default it does not detect given types.
In order to export with corresponding type it is necessary to set specific parsing format using the following methods:
setDateTimeParseFormat(String) // DateTime
setDateParseFormat(String) // Date
setTimeParseFormat(String) // Time
It will be applied for all dateTime, date, time properties in the PivotTable.
@Inject
private PivotTable pivotTable;
private PivotTableExtension extension;
@Subscribe
private void onInit(InitEvent event) {
extension = new WebPivotTableExtension(pivotTable);
extension.setDateTimeParseFormat("dd/MM/yyyy HH:mm");
extension.setDateParseFormat("dd/MM/yyyy");
extension.setTimeParseFormat("HH:mm");
}
Another little improvement is automatic resizing column width according to the length of content in the widest cell in column.
Current API is misleading.
We should provide better methods, for instance:
pivot.getAggregations().setSelectedAggregation(new Aggregation())
See the main issue: cuba-platform/cuba#965
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.