I would like to know how to have a shared Crosshair. I have a CombinedXYPlot with 5 XYPlots and when I click on the graph, I would like to have one single Crosshair that will appear on each SubPlot. For the moment, when I click on a SubPlot, the Crosshair appears only on this SubPlot :
List<XYPlot> lxyp = t.getSubplots();
for (XYPlot xyp : lxyp) {
xyp.setDomainCrosshairVisible(true);
xyp.setDomainCrosshairLockedOnData(false);
xyp.setRangeCrosshairVisible(false);
}
Then, how to change the color and the thickness of this Crosshair ?
Thanks for your response !
I am unfamiliar with CombinedXYPlot, but the method setDomainCrosshairStroke() may available. This affords all the features of BasicStroke.
subplot1.setDomainCrosshairVisible(true);
subplot1.setDomainCrosshairPaint(Color.red);
subplot1.setDomainCrosshairStroke(new BasicStroke(1f));
...
subplot2.setDomainCrosshairVisible(true);
subplot2.setDomainCrosshairPaint(Color.blue);
subplot2.setDomainCrosshairStroke(new BasicStroke(1f));
Related
I'm trying to implement a custom barchart
which should look exactly like this. I tried mpChart but could only get this far
barDataSet = new BarDataSet(barEntries, "");
barData = new BarData(barDataSet);
barData.setBarWidth(.5f);
barChart.setData(barData);
barDataSet.setColors(getResources().getColor(R.color.colorPrimary));
barDataSet.setValueTextColor(Color.BLACK);
barDataSet.setDrawValues(false);
barChart.getXAxis().setDrawAxisLine(false);
barChart.setDrawGridBackground(false);
barChart.getXAxis().setDrawGridLines(false);
barChart.getAxisLeft().setDrawGridLines(false);
barChart.getAxisRight().setDrawGridLines(false);
barChart.getAxisLeft().setEnabled(false);
barChart.getAxisRight().setEnabled(false);
barChart.getLegend().setEnabled(false);
barChart.setPinchZoom(false);
barChart.setDescription(null);
barChart.setTouchEnabled(false);
barChart.setDoubleTapToZoomEnabled(false);
barChart.setExtraOffsets(20, 0, 0, 30);
XAxis xAxis = barChart.getXAxis();
xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
xAxis.setTextSize(14f);
xAxis.setTextColor(Color.BLACK);
xAxis.setYOffset(5);
xAxis.setDrawLabels(true);
xAxis.setGranularityEnabled(true);
xAxis.setGranularity(1f);
xAxis.setXOffset(30);
xAxis.setValueFormatter(new IndexAxisValueFormatter(xAxisLabel));
xAxis.setCenterAxisLabels(true);
barChart.invalidate();
I tried almost all possible examples and questions here, couldn't get the label to centre of the bars. Is it possible to put the labels exactly below the bars in non grouped bars? all the solutions I saw is only for grouped bars or combined charts.
I was plotting the x axis values from 1. when changed it to 0 and removed
xAxis.setCenterAxisLabels(true);
and i was able to centre the axis labels
You need to create a custom renderer for it.
Subclass BarChartRenderer and then call:
barChart.setRenderer(new MyBarChartRenderer(barChart, barChart.getAnimator(), barChart.getViewPortHandler()))
It will even allow you to alter the shape of it as described here.
But I think what you're looking for comes really close to this.
Download the MPAndroidChart Source from here. Then, you can customize the code according to your need and add it your project by
Clicking on File>New>Import Module.
I have an issue regarding "SKHeading". When i use (SKMapSettings.SKHeadingMode.ROTATING_MAP) and starts navigation i am getting a triangle on my navigated route which define a header i want to edit that header to smaller one but i am not able to find it in code can you please suggest me how to do that one. So that i can make that header triangle small and play around with it.Below is my code:
SKNavigationSettings navigationSettings = new SKNavigationSettings();
navigationSettings.setNavigationType(SKNavigationSettings.SKNavigationType.SIMULATION);
navigationSettings.setPositionerVerticalAlignment(-0.25f);
navigationSettings.setShowRealGPSPositions(true);
navigationSettings.setShowStreetNamesPopusOnRoute(true);
navigationSettings.setDistanceUnit(SKMaps.SKDistanceUnitType.DISTANCE_UNIT_MILES_FEET);
navigationSettings.getSpeedWarningThresholdInCity();
SKNavigationManager sknavigation = SKNavigationManager.getInstance();
sknavigation.setMapView(mapView);
sknavigation.setNavigationListener(this);
sknavigation.startNavigation(navigationSettings);
navigationInProgress = true;
mapView.centerOnCurrentPosition(17, true, 500);
mapView.getMapSettings().setHeadingMode(SKMapSettings.SKHeadingMode.ROTATING_MAP);
startOrientationSensor();
This is the line which creates that triangle.
mapView.getMapSettings().setHeadingMode(SKMapSettings.SKHeadingMode.ROTATING_MAP
Need to remove/edit this red circle triangle.
i have found the solution for this issue if anyone face such kind of issue you just have to comment or make the value of this line
navigationSettings.setShowRealGPSPositions(true);
this line has to look like below:
navigationSettings.setShowRealGPSPositions(false);
I'm using OSMdroid library in my project to display map tiles (it's a shape with lines and blank background) from my company local sever in my app. The thing is when I use the app in offline mode and I browse the map shows an empty grey grid background for the tiles that aren't in the cache, and I want to change that empty grey grid for an blank background image/tile.
The only workaround that I've found to achieve this is the following:
Add a tile overlay and set setLoadingBackgroundColor and setLoadingLineColor to Color.WHITE, and then set the TileSource from the local server from OnlineTileSourceBase. I know this is not quite performant, so is there a better way to do this? Thanks in advance!
final ITileSource tileSource = new OnlineTileSourceBase(...)
{
#Override
public String getTileURLString(MapTile aTile) {
return getBaseUrl() + aTile.getX() + "+" + aTile.getY() + "+" + aTile.getZoomLevel();
}
};
tileProvider = new MapTileProviderBasic(context, tileSource);
tilesOverlay = new TilesOverlay(tileProvider , context);
tilesOverlay.setLoadingBackgroundColor(Color.WHITE);
tilesOverlay.setLoadingLineColor(Color.WHITE);
this.map.getOverlays().add(tilesOverlay);
this.map.setTileSource(tileProvider.getTileSource());
map.invalidate();
Your code is an example on adding a secondary tile overlay. That's useful for when you need another raster graphics overlay on top of the map imagery.
You can also change the loading lines and background for the existing and default tiles overlay. This should get you going
mMapView.getOverlayManager().getTilesOverlay().setLoadingBackgroundColor(Color.TRANSPARENT);
mMapView.getOverlayManager().getTilesOverlay().setLoadingLineColor(Color.TRANSPARENT);
I need to get the rectangular coordinates of the annotation using ice pdf viewer. Is there anyway to achieve this?
You'll need to go into the Viewer RI source code make a few changes and then rebuild the icepdf-viewer.jar.
The class org.icepdf.ri.common.tools.SquareAnnotationHandler handles all the mouse events and drawing for creating a Square annotation. This is a good place to start for extending or using it as a reference.
Add a message dialog to under mouseReleased
JOptionPane.showMessageDialog(null, "Rectangle coordinates x ---> "+rectToDraw.x+" y --> "+ rectToDraw.y+" Width --> "+ rectToDraw.width+" height --> "+ rectToDraw.height);
If anyone is still looking for answer.
Icepdf's Annotation class holds these coordinates. They can be retrieved like this:
Rectangle2D.Float box = annotation.getUserSpaceRectangle();
Map<String, Double> bounds = new HashMap<String, Double>();
bounds.put("height", box.getHeight());
bounds.put("width", box.getWidth());
bounds.put("x", box.getX());
bounds.put("y", box.getY());
Imagine I have a model of a human with some accessory like sunglasses, a hat, a chain and so on. Is there any way to switch the visibility of those items inside my libGDX application, by writing something like:
modelInstance.getNode("sunglasses").setVisible(false)
You can set a blending attibute to its material:
blendingAttribute = new BlendingAttribute(GL10.GL_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);
material = modelinstance.materials.get(0);
material.set(blendingAttribute);
Then you can set its opacity like this:
blendingAttribute.opacity = 0.5F; //0-1