How to draw border around the chart area in Google Charts? - charts

I need a border around just the chart area and not the whole chart. I can't find what property to set. This is in the Google Visualization API.

The appropriate option is undocumented. You need to set the chartArea.backgroundColor.stroke and chartArea.backgroundColor.strokeWidth options. The stroke option controls the color of the border, and takes any valid HTML color string. The strokeWidth option controls the width of the border, and takes an integer for the width in pixels:
chartArea: {
backgroundColor: {
stroke: '#4322c0',
strokeWidth: 3
}
}

Related

Flutter SfCharts label padding

How can I add padding to the labels, or position them further away from the plotting area? It currently looks like this, but I want to increase the red space:
I am using the SfCartesianChart from the flutter_syncfusion_charts package.
I suggest you use the majorTickLines property in the axis, using this you can achieve your requirement by setting the size of the tick and setting the color as transparent. I have attached the code snippet below for your reference.
Code snippet:
primaryYAxis: NumericAxis(
majorTickLines:
const MajorTickLines(size: 15, color: Colors.transparent)),
UG: https://help.syncfusion.com/flutter/cartesian-charts/axis-customization#tick-lines-customization

Anylogic: Adding text label to Rectangular Wall

Is it possible to add a text label on top of rectangular walls in Anylogic? I am trying to dynamically create rectangular walls using code and then adding labels. So far I am able to create the walls but the text label does not appear on top of the walls as I want it.
If you are creating walls dynamically I assume you also want to create your text dynamically.
There is a little trick in AnyLogic where you can view the code that gets created for you by AnyLogic discussed in this blog post
You can use the code snipped below to draw a Text object and add it to the presentation collection (which is needed for it to be displayed)
Font _text_Font = new Font("SansSerif", 0, 10 ); // Only needed if you don't have any text in your agent else _text_Font gets created for you.
ShapeText myProgramticallyCreatedText = new ShapeText(
SHAPE_DRAW_2D, true,170.0, 90.0, 0.0, 0.0,
black,"Programatically Created text",
_text_Font, ALIGNMENT_LEFT );
presentation.add(myProgramticallyCreatedText);
Here is the syntax for creating your
ShapeText(boolean ispublic, double x, double y, double rotation, java.awt.Color color, java.lang.String text, java.awt.Font font, TextAlignment alignment)
Constructs a 2D-only text shape with specific attributes.
ShapeText(ShapeDrawMode drawMode, boolean ispublic, double x, double y, double z, double rotation, java.awt.Color color, java.lang.String text, java.awt.Font font, TextAlignment alignment)
Constructs a text shape with specific attributes.
Depending on whether or not you have 3D or not you can rotate the text by changing the correct parameters
If you want to make it visible in 3d and also rotate it correctly you need to create a group, add the text to that group, then create a new group, and the group this new group and then rotate the first group. Like below
Font _text_Font = new Font("SansSerif", 0, 10 );
ShapeText myProgramticallyCreatedText = new ShapeText(
SHAPE_DRAW_2D3D, true,170.0, 90.0, 0.0, 0.0,
black,"Programatically Created text",
_text_Font, ALIGNMENT_LEFT );
ShapeGroup innerGroup = new ShapeGroup(this, SHAPE_DRAW_2D3D, true, 170.0, 20.0, 0.0, 0.0 , myProgramticallyCreatedText );
ShapeGroup outerGroup = new ShapeGroup(this, SHAPE_DRAW_2D3D, true, 170.0, 20.0, 0.0, 0.0 , innerGroup );
innerGroup.setRotationX(-PI/2 );
presentation.add(outerGroup);
(P.S. I figured all of this out using the trick from the blog post referenced above ;-) )
If it should show horizontally on top of the wall, just ensure it has the same x,y coordinates as the center of the wall and then set the z-coordinate higher than the wall height.
If you want to show it vertically (like a clock hanging from the wall), you need to set the xY coordinates carefully so it does not display inside the wall. Z coordinate half way of the wall height. And then you need to do a trick to turn the text: put it into a group and rotate the group. The example model "Airport terminal" does that, check it out

How to make Echarts areaStyle fill whole polar?

I'm working with line-polar eCharts on Angular, and I ran into a problem with areaStyle. I want it to fill the whole area from the line to the outer most circle with the yellow color, but eCharts left out a little bit of empty space. I tried creating a shadowBlur and offsetX, Y it to the blank area, but the color is not the same. Is there a property of areaStyle I'm missing, or is there a library to fix this?
series = [{
coordinateSystem: 'polar',
name: this.legends[1],
type: 'line',
color: '#D9B100',
data: this.datasetCylinder.data,
smooth: true,
showSymbol: false,
lineStyle: {
show: true,
width: 3,
shadowBlur: 10,
shadowColor: 'gold'
},
areaStyle: {
color: 'gold',
origin: 'end',
opacity: 0.1
}
}]
A simple solution would be to add more points in between, but then chart yellow line might not have the correct form. Any suggestion is appreciated.
There is no easy solution but you can try to find it:
Draw the area outside the circle boundaries and then cut the excess with VisualMap.
Cut area in already filled circle by VisualMap with pieces.
Use custom series and draw all with polygons.

make bigger space for legend in echarts

I'm using echarts
this is my chart
this picture shows I lost some of my legends , so,how do I make bigger space for legends, is it possible to set more space for legends? or if it is possible to make my chart smaller how can I do?
I put
var option = {
grid: {
y: 30,
y2: 90,
},
y mean space before chart, y2 - after chart

iOS Charts Pie Chart Size

I am using iOS Charts with Swift 3.
I have a 100 x 100 PieChartView that renders the pie chart, but it's not filling the view (an NSView, to be precise). The gray box is the view and there's a large gap between the pie and the edge.
I have confirmed that the view is 100 x 100:
print(graph.frame) //<-- (25.0, 65.0, 100.0, 100.0)
So I assume there is something I need to configure in the pie chart to allow it to be the full size in the view. Here's what I've tried so far to no avail:
graph.holeRadiusPercent = 0.7
graph.transparentCircleRadiusPercent = 0
graph.legend.enabled = false
graph.chartDescription?.enabled = false
graph.minOffset = 0
Any ideas?
Found it! It turns out my graph was rendering the values in the pre-selection state. If I clicked on a pie segment, it would grow larger.
So by setting this property, the graph fills the available space:
ds.selectionShift = 0 //'ds' is my PieChartDataSet
I hope that helps someone else.