I just installed and tried the sample GettingStartedActivity, I tried to use 10 numbers to draw the column chart on a screen and it worked well. Then I tried to create a activity which has two component. The first component (textView) which occupy the half of the screen showed 10 numbers and related information, the second part (ChartView) showed the chart. It does show the chart, but it missed some information. First, the number on each column top only showed half part of the number, second, the x and y axis are missed. It looks like only the center of the chart showed on the screen. I guess the reason is that I only have half screen given to chart, right? I saw your screenshot samples and know that your application can make the chart showed completly on part of the screen in stead of the whole screen. But I do not know how to do that. Could you help on informing it. Thanks.

Well, I do not understand why ArrayAdapter is needed here, for the same reason why cell.xml is useful. I think GridView and ChartView will do the job (which might be the reason of my problem). That is what I did in my application:

Code:

setContentView(R.layout.main);
// show ten lines in textView and each line show some string
textView = (TextView)findViewById(R.id.textView_record);
// show chart in chartView which draw a chart using your sample code
chartView = (ChartView)findViewById(R.id.chartView_record);
ChartArea area = chartView.addArea();
ChartSeries series = new ChartSeries( "DemoSeries", ChartTypes.Column);
series.getPoints().setData(recordsArray);//recordsArray has ten numbers
series.setShowLabel( true );
chartView.getSeries().add( series );
series.setArea( area.getName() );

Also, I only have one xml in layout dir which is similar to main.xml in the Grid example. I could show textView and chartView on screen, but the problem is that chartView only show center part without x and y axis (as I described in the first post). Could you help to figure out the problem? Thanks for the help!

Perhaps if you'd attach your project you are working on, we could figure out why chart behaves this way. Please provide as detailed as possible description of desired output. You are also welcome to purchase aiCharts library along with a subscription. This way you will receive latest library updates and any kind of consulting you require.

Thank you pturchenko. I am just doing a demo, if this works out as desired, it is quite possible that my boss will buy it. :)

I figured out the problem, because I set the main layout background to white color...

Now it can show the column chart well, the y axis shows the number corresponding to the actual numbers for each column, but for x axis, now it shows 0.0, 2.5, 5.0, 7.5 and 10.0. Since I have ten columns, I am wondering if the x axis could show 1,5,10 or 1 to 10 under the corresponding column. Now the code is as below:

Another problem is that when I press the chartViewButton, the above code will show the chart on the screen. If I press the button for second time, the screen will show two same charts, three charts for the third press...., how to make it to show only one chart and clear the previous chart somehow.

You are right, each time clicking the button will add a chartArea (hide the textView and show chartView which are in same activity), that is the reason if i click button twice, it will show two same charts on screen, but I do not know how to remove it or reuse it as you adviced, could you help to solve the problem? Thanks.

I showed the chart to my boss and he like it. Currently, I used two chart type from your lib, one is column and the other is line type. Both charts shows ten numbers which like 123, 223, 98, 166...I am wondering if the following two requirements is applicable.

First, is it possible to draw a horizontal line accoring to a value like 100, since 100 is a special value in my app.

Second, is it applicable to change the color to different one for the part that is above a value. For example, now the default column/chart color is red, for the column/chart that is above 100 on y axis, it is another color, in other words, one column could has two color, one color for lower part below 100, one color for upper part above 100.

I saw some of your samples in which a column has two or three colors, so I think the second requirement might be applicable, or both. If so, could you please provide details on how to make it happen? Thanks.

Thanks a lot for your kind help and support. I put your code into mine, and got the result as the attahed picture.

As it shows, the whole area that is above 100 has changed color, but the columns that above 100 value do not change the color which is what I wish to do. I need not area to change the color, just the column.

And the horizontal line of 100 has the same color as 200 and 300, I wish its color is special.

Hi. It would be great if you draw an image of chart you are trying to come up with. It's kind of hard to figure out from your code snippets what's exactly wrong. We'll try to create a sample that does what you need.

I worked out the stripline (green one) as attached pic showed, the left problem is to show column that has different color for the part above the stripline. Now, those columns in blue are expected to show two colors, red color below the stripline and blue color above the stripline. Please give some help on it at your convenience. Thanks!

Code:

area = new ChartArea();
area.getDefaultXAxis().setLabelsMode(ChartAxis.LabelsMode.SeriesLabels);
area.getDefaultXAxis().setFormat("%.0f");
series = new ChartSeries( ChartTypes.Column);
for(int i = 0; i < recordsArray.length; i++)
{
series.getPoints().addXY(i+1, recordsArray[i]);
}
series.setShowLabel( true );
// set color to different one for the part above normal value
processPoints(series);
// set special color for the stripLine that is equal to normal value
ChartAxisStripLine stripLine = createStripLine(NORMAL_VALUE);
area.getDefaultYAxis().getStripLines().add(stripLine);
chartView.getAreas().add(area);
chartView.getSeries().add( series );

You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.