Xcl-charts Chart Library Brief introduction and Frequently asked Questions

Source: Internet
Author: User
Tags polyline

This andriod Chart Library project from the beginning to the present, the enthusiasm consumption is almost exhausted. Fortunately, the basic realization of the things I want to do. Take advantage of some of the remaining points of interest and make some very simple generalizations.

Supported chart types:

Base class chart Name

Barchart Horizontal/Vertical column chart and back-column chart

Barchart3d Horizontal/Vertical 3D Column chart

Stackbarchart Horizontal/Vertical Stacked column chart

Rangebarchart Range Column Chart

Linechart Line Chart

Splinechart curve

AreaChart Area chart (polyline/smooth)

Piechart Pie Chart

Piechart3d 3D Pie Chart

Dountchart Ring Chart

Arclinechart Arc Comparison Chart

Rosechart Nightingale Rose chart/rose Wind chart

Funnelchart Funnel Chart

Circlechart Circle/semicircle Chart

Bubblechart Bubble Chart

Radarchart Radar Chart

Gaugechart Scale Plate

Scatterchart Scatter plot

Dialchart instrument panel





Main composition (Note: Many of the naming is my own name, professional not too serious, can achieve the effect is good.) )

Chart Range:

That is, the extent of the blue gradient background in the diagram.

To set a function:

Setchartrange (float width, float height)
Setchartrange (float StartX, float starty, float width, float height)

Plot Area:

The range of the yellow part of the figure.

You can use the following function to set the spacing between the plot area and the entire chart range:

Setpadding (float left, float top, float right, float bottom)

Getplotarea ()

If the amount of data is too much, when the screen is not displayed, you can expand the range by Getplotarea (). Extwidth () to see through the gesture swipe.

Title bar:

Sub-main title and sub-title

Partial functions:

Settitle (java.lang.String title)
Addsubtitle (java.lang.String subtitle)


Axis:

The axis is divided into two data axes and a category axis, which can be displayed in the upper and lower left or right positions, or in any position depending on the data value.

Reference function:

Getdataaxis ()
Getcategoryaxis ()


Axis title:

can set the title of the top and bottom three parts

Reference function:

Getaxistitle ()


Legend:

You can set the row or column mode and display it anywhere in the chart.

Partial functions:

Getplotlegend ()


Dynamic legend:

Can be added to various chart descriptions.

Reference function:

Getdylegend ()

Custom Line

Used to make various marks or dividing lines.

To set a function:

Setcustomlines ()


Diagram annotations

used when displaying, when specifically identified on a chart-specific element.

To set a function:

Setanchordatapoint ()


Focus Frame

When clicked, identifies the currently selected item.

Activation function:

Showclikedfocus ();


Focus line (dynamic line):

Used to display other marker lines, such as the associated Crosshair, when clicked.

Showdyline () activation.

Getdyline () Gets the related object.


Chart Zoom:

Disablescale () Disabled

Enabledscale () enabled


Gesture Swipe

Disablepanmode () Disabled

Enabledpanmode () enabled

Setplotpanmode () Set slide mode (up/down/left/right/in any direction)


Problems:

1. No function was found to set the color.

Find the brush for the relevant subclass and set the color yourself.

If you set the color of the axis:

Chart.getdataaxis (). Getaxispaint (). SetColor (Color.Blue);


2. Font size does not change with screen size

You can set the font size of the relevant sub-class brush by the screen size.

For example, set the chart main title font size:

Chart.getplottitle (). Gettitlepaint (). Settextsize (22);


3. Hide the scale/label on the axis or axis

Take the data axis for example:

Chart.getdataaxis (). Hideaxisline ();
Chart.getdataaxis (). Hidetickmarks ();
Chart.getdataaxis (). Hideaxislabels ();

The category axis is likewise.


4. How to set the display format on an axis or on a chart object:

The gallery provides related callback functions, which can be implemented by itself.

A simple example code:

Defines the data axis label display format Chart.getdataaxis (). Setlabelformatter (New Iformattertextcallback () {@Overridepublic String TextFormatter (String value) {//TODO auto-generated method stubdouble tmp = double.parsedouble (value);D Ecimalformat df= New DecimalFormat ("#0"); String label = Df.format (TMP). toString (); return (label);});
Other and so forth.


5. If you are passing values from activity to the view, refresh

A simple example of refreshing two graphs at the same time:

Activity:   chartview.refreshchart (LinePoint1, LinePoint2); View: Public   void Refreshchart (list<pointd> linePoint1, list<pointd> linePoint2) { Dataseries1.setlinedataset (linePoint1);d ataseries2.setlinedataset (LinePoint2); This.invalidate ();}

6. How to handle the double y-axis

Multi-image overlay. Refer to the examples of mixed graphs in the demo below.


7. A column chart and a line chart are required to display together

Multi-image overlay. Refer to the examples of mixed graphs in the demo below.


8. Need to specifically identify a point or value

You can use a diagram annotation.


9. Need to show this or that animation effect

You can refer to some examples in the demo animation, such as fade, from the far and near to their own implementation, can also call third-party library to do.


10. Can I set the column width

The column size is automatically set according to the width of the plot area and the number of columns, and cannot be specified explicitly.


11. The chart moved out of the plot area range is missing.

It is currently free to move and can be done using Hscrollview. Refer to the relevant examples

12. Data volume is very large, sliding speed is slow

If you don't need to click and zoom, you can use Hscrollview to do this, or you can use Disablehighprecision () to improve performance.

But this function pie chart class diagram is used with caution.


13. How to get the clicked object and related value of the chart in activity

can refer to demo, have related demonstration.


14. What do the thermometer shafts/unequal axes do?

Xcl-charts currently does not support, but fortunately big S shared a classic implementation, in the user Chart Library directory.


15. The area map has no gradient effect.

There, you can specify a gradient start and end color, from top to bottom or from left to right.


16. The legend should be displayed below or around.

There are related functions, which can be set directly. Examples are available in the demo.


17 an axis to display at the top

There are related attributes that can be set directly. Examples are available in the demo.


18. Examples of line graphs sliding left and right

Two view, one view for displaying the y-axis, the graph title, the legend, and the other for displaying scrollview and graphs.


The y-axis title appears at the top, and the x-axis title appears in the lower-right

In either case, refer to the "Vertical Custom Line Column Chart" example in the demo.

Either in the view's render (), the relevant coordinates are obtained by Chart.getplotarea (). GetLeft () and Chart.getplotarea (). GetTop () and other functions.

Direct DrawText can be.


20. What do I do when I click on the button to select not sensitive?

Using Extpointclickrange (10); Enlarge the selected range.


21. When the gesture moves, the axis label has been moved out of the plot area and is still displayed.

There are related functions to control, move out of the display range, in the x direction for example:

Shrink down when panning
float margin = densityutil.dip2px (GetContext (), 20);
Chart.setxtickmarksoffsetmargin (margin);

The y direction is analogous to the example above.


22. The pie chart label polyline extends from the beginning of the sector edge.

You can set the line start point directly. Chart.getlabelbrokenline (). Setbrokenstartpoint (10f); A ratio of 0-10 to the value.


23. Pie chart labels and lines are the same color as the sectors.

Chart.synclabellinecolor ().


24. Does the pie chart data go in with gaps or not displayed?

The float and double types in Java are calculated with errors. Cause the central angle total to be less than or exceed 360 degrees.

It is recommended to call the related functions in the Mathhelper class in the library for calculation processing.


25. The pie chart label is too dense to see clearly.

Too dense tags do not overlap the processing algorithms are not interested to study, but the library has provided 5, 6 kinds of label display style. It is recommended to stagger the size of different sectors,

Different sectors are assigned different label display styles to handle.


26. I need to synchronize more diagrams and refresh the data regularly.

Demo, you can refer to the example of two-line graph.


27. Where can i download the source code?

Https://github.com/xcltapestry/XCL-Charts


28. After downloading why so many forks.

Re-import the Xclcharts.jar.


29. There are two works.

Xcl-charts is the project that generates the JAR

Xcl-charts-demo is used to demonstrate the project.


30 How to put a chart in XML, in Chartsactivity is all code-generated.

Pro, there are many other examples where view is placed in XML. Don't stare at chartsactivity one.


31. How to take up so much memory.

For the side-hung demo example, only chartsactivity generated more than 40 view at a time. You singled out for a try, though because of the strong customization, so many options,

But the man also used a lot of optimized memory means.


32. A lot of fine classes.

Well, because I ambition relatively large, packaged parts, no longer want to add any diagram, just focus on the implementation of the diagram itself logic can.

Brother is a set of Android graphics platform, rather than just a certain type of drawing.

Again, write code in Java is verbose, I now very much like Golang.


33. I write more code than you do.

I'm a cross-border Oracle DBA that writes C + +. For Java is now learning to use, you can not ask me too high .....

Suggestions for optimization are welcome.


34. How issues to now only 4.

Maybe my code is really well written.

Maybe everyone is very busy.

Maybe everybody take care of my face.

This library may never have been used by anyone.

..............

35. What is the design idea of the group owner and library?

Don't know how to answer. I only think of a few, figure effect to dazzle, customization to high, call to be flexible, the complex diagram can be combined with the combination of graphs to achieve.

All components should be encapsulated so that I can add the diagram later.


36. Why is there no fire in this library?

First think of these several possible reasons: nearly single-handedly + people's own belittle + everyone is very busy + ...

And then think, these are p ah. Don't forget beginner's mind know not.


37. Where are the documents for this library?

The doc directory has the Java Doc check function and the associated API. Other direct look at the demo bar, there are currently 40 of several examples, you think I really very busy?


38. Group master, ask a achartengine question

I'm sorry, I've never used achartengine. Have browsed the source code, very classic, but never read.


39. Help to see the Mpandroidchart problem

Sorry, I haven't studied it, but I've seen Mpandroidchart demo. Then, I think I do a lot better than this.

At least the chart calls and combinations are more flexible and the chart types are more.


40. I just want to extract some of your code.

Rolling.


41. Don't you want to take your hand?

Yes, I have said that I have closed my hands many times.



MAIL: [Email protected]

blog:http://blog.csdn.net/xcl168


Xcl-charts Chart Library Brief introduction and Frequently asked Questions

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.