Three: answer doubts

The 1.java rounding:

// a way: BigDecimal way
Double f = 3.1315;
BigDecimal b = new new BigDecimal (new new Double (f) .toString);
Double f1 = b.setScale (3, BigDecimal.ROUND_HALF_UP) .doubleValue ();
Note: Be sure not here direct use of new BigDecimal (double) constructor,
and to use new BigDecimal (new Double (1.1315) .toString ()) way, otherwise there will be precisely the problem

// Second way: DecimalFormat manner
// defaults a RoundingMode.HALF_EVEN DecimalFormat this type, and the results after the format is a string type String
DecimalFormat new new DF = DecimalFormat; ( "# 000.")
System.out.println ( df.format (the BigDecimal new new (1.0145))); 1.014 //
System.out.println (df.format (the BigDecimal new new (1.1315))); // 1.132

// three ways:
Double D = 3.1415926;
String String.format Result = (. "%. 2F", D);
.% .2f% // arbitrary number of digits before the decimal point represent 2 shows the results of the two-decimal format f floating-point representation.

// four: Math.round conventional rounding, the number of bits to specify the exact wording support
Math.round (5.2644555 * 100) * 0.01D;
Private static Double myRound (Double Number, int index) {
Double Result = 0;
TEMP = Math.pow Double (10, index);
Result = Math.round (Number * TEMP) / TEMP;
return Result;

}
Note: This method is best not to use Fourth, continue to be calculated directly because of the use of double, there will be loss of accuracy problems, such as 0.5075 multiplied by 1000, the result is 507.49999999, so the final result will be rounding error.

Reprinted Source: https://blog.csdn.net/w1014074794/article/details/53640731

2.echarts3 and echarts2 difference

echarts is Baidu launched a simple and practical chart control Personally it seems, usability and aesthetics most chart code echarts2 better, relatively speaking, echarts3 there are many areas for improvement, such as imported modules and other optimization options and icons and so on, I do the map in recent major development with echarts, on some personal experience summarized as follows:

1, js file:
  The first is the js file, echarts3 done a lot of optimization, in echarts2, library management of the various controls in some detail, there is a special directory structure to store the relevant js files and associated resources, but in introducing the document, it tends to be inconvenient, might accidentally miss a file, and echarts3 as needed depending on the desired function library architecture, as long as the use of a echarts.min imported directly under downloads. js file can be.

2, file import:
  In echarts2 in, require as modular loading entrance, in the course of on-path configuration problems often occur, especially in making the map, but in echarts3 need only add that at the beginning of

  the next long call interface on it.

3, offline maps:
  the presence echarts2 offline map accuracy in a big problem, in particular in the drill district level, the fuzzy boundary is present, intersect, gaps and other issues, and often enclave, compared with the actual access map big, think basically useless, in echarts3 in has done a great improvement, basically solved the above problems, between the city and the city, there is substantially no interface issues between districts and counties.
  In addition, in echarts3 can build their own maps as needed, to actually use this service it provides great convenience.

4, the toolbar:
  In the toolbox inside echarts3 of the auxiliary lines cancel the function, the icon smaller, the feeling inside the toolbox echarts3 more ugly overall.

5, roam Map tools:
  in echarts3 inside the map cancel roaming tool, to be honest, echarts2 inside look at the map roaming tool was quite good, although there is nothing available.

6, the coordinate system:
  echarts3 in a unified data structure abstraction, the most common data structures are: linear tables, trees, FIG. For example, a tree structure of linear form and, FIG node list may be normalized to this two-dimensional array:
  Another important data structures are independent abstraction echarts3 a conceptual "coordinate system." In fact ECharts 2 has grid, polar configuration item exists, but is not understood by a "coordinate" to go to achieve. echarts3 in support of the Cartesian coordinate system (catesian, compatible echarts2 the grid), polar coordinates (polar), geographic coordinate system (geo).

7, Option Changes:
  1) like component location x, y, etc. into a left, top, and the percentage of pixels may be used, adaptable.
  2) In order to make a more rational structure, echarts3 label is moved out of the same level and itemStyle.
  According to the official statement, in echarts3 in previous conventions it is compatible, but not recommended.

Reprinted Source: https://blog.csdn.net/jnx1142410525/article/details/55056197

Guess you like

Origin www.cnblogs.com/itzlg/p/10930060.html