Recently I am working onWPFSome statistical functions are required for projects, and some histograms and linear graphs need to be created. Generally, the traditional histogram and linear graph compiling methods are as follows:
1.OKXAxis andYAxis.XAxis andYAxis.
2.DrawXAxis andYAxis, such as adding two arrows.
3.ThenYValue,
A.For the histogram, SetYThe value is converted to the height of the rectangle in the histogram.XDetermine the value of the rectangle inXAxis Position.
B.For a line chart, SetYThe value is converted to the height of the vertices in the histogram.XValue Determination pointXAxis Position.
4.If the histogram contains multiple data sequences, you need to consider using different colors to represent the rectangle. The same is true for linear graphs.
It looks quite troublesome. The following histogram is used as an example:
A histogram actually consists of the following parts:
1.The coordinate axis and the coordinate axis must determine the scale and the scale range. For example, the width of a small scale and a large scale must be calculated. In addition, you also need to determine the range of large scales and small scales based on the data indicated by the coordinate axes. What should we do if the data indicated by the coordinate axis is an integer, what should we do if the data is of the date type, and what should we do if the data is of the string type .......
In addition to data, you also need to consider the format and layout of the coordinate axis. For example, is the scale displayed under the coordinate axis (left), above (right), or directly displayed on the coordinate axis? Axis title (Axis title) How to display ......
You also need to consider the axis style. For example, some people prefer to add a small arrow to the axis to indicate the trend of data. Therefore, when determining the axis (length or height, A little extra space is required (for the arrows ).
For example, if the user needs to, the scale of your coordinate axis is not displayed in strings, but in images. The histogram control needs to be easily extended to this situation.
In addition, the position of the origin of the coordinate axis can be changed. For example, you may need to specifyXAxis slaveYA value of the Axis passes through, rather than from0This position passes through, of courseYThe axis may also needXNon-0The value passes through.
2.ForYAxis, there are some special requirements, for example, sometimes,YFor example, many values may be1And some values1000The preceding steps are as follows:10In the scale metering method, some data cannot be displayed, or the display height is too large to be beautiful. Therefore, the metering method of the scale will change a bit, for example, accordingLogTo set the scale (referOffice 2007In the histogram settings interface to experience this )......
3.Statistical Chart area. The histogram cannot be displayed only. A series of data, the Histogram can display three series of data (Series 1, Series 2AndSeries 3). Therefore, the following issues are exported:
A.First, of course, the height of the rectangle of each series of data should be calculated. In this case, make sure thatYThe scale of the Axis matches the height of the rectangle.
B.If there is more than one series of data, you need to use differentEye-catchingTo identify different series, please note that the eye-catching color determines that we cannot use random numbers to generate colors, because the difference between light blue and blue is certainly not obvious between green and blue.
C.The grid (width) may be required in the Statistical Chart, so that the data represented by the rectangle in the Histogram can be displayed more intuitively.
D.You may also want to display data on the histogram, which is the same as the histogram in our example. Of course, the placement of this data will also be exquisite, for example, whether it is placed on the top of the rectangle or in the middle of the rectangle.
4.The layout of the title and other parts of the Statistical Chart. For example, you can place the title on the top, bottom, left, right, or custom location of the drawing area.
5.And so on.
6....
It seems that this histogram does have many things to do. The road is long, the revolution is not yet successful, and it is not yet complete.