Go Back   SmartClient Forums > Smart GWT Technical Q&A
Wiki Register Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 7th Mar 2012, 10:45
jamesC jamesC is offline
Registered Developer
 
Join Date: Jan 2012
Posts: 26
Default Charting

I need a number of small charts. Is there any way to remove the axis labels, and render the chart size based on min to max values? Or is this as small as it gets?

Code:
import com.smartgwt.client.data.Record;
import com.smartgwt.client.types.ChartType;
import com.smartgwt.client.util.SC;
import com.smartgwt.client.widgets.chart.FacetChart;
import com.smartgwt.client.widgets.cube.Facet;
import java.util.HashMap;
import java.util.Map;

/**
 * A small unlabeled line chart of data for display
 */
public class MiniatureChart extends FacetChart
{
    Record data[];
    private static final String facet = "time";
    private static final String val = "value";

    public MiniatureChart()
    {
        if (SC.hasCharts() && SC.hasDrawing())
        {
            setChartType(ChartType.LINE);
            setShowDataPoints(false);
            setShowLegend(false);
            setShowTitle("");
            setFacets(new Facet(facet, facet));
            setValueProperty(val);
            setMaxBarThickness(0);
            makeFakeData();
            setData(data);
        }
    }

    @Deprecated
    private void makeFakeData(){
        Map<String, Object> test;
        data = new Record[25];
        for(int i = 0; i < data.length; i++)
        {
            test = new HashMap<String , Object>();
            test.put(facet, new Long(System.currentTimeMillis()));
            test.put(val, new Integer(100+i));
            data[i] = new Record(test);
        }
    }    
}
Attached Images
File Type: png SmallestChart.png (15.8 KB, 22 views)
Reply With Quote
  #2  
Old 10th Mar 2012, 09:21
Isomorphic Isomorphic is offline
Administrator
 
Join Date: May 2006
Posts: 37,158
Default

By providing explicit facetValues you can provide titles for each value that are very short or just blank, hence removing all of the space used for X-axis labels. There's no way currently to get rid of gradations labels if you wanted to remove those too.

If your use case is something like miniature charts on every row of a grid, also look at JQuery "sparklines" - some people use this by justing using a cellFormatter to add a DIV with a known ID to the grid cell, then writing a sparkline into that DIV.
Reply With Quote
  #3  
Old 12th Mar 2012, 11:19
jamesC jamesC is offline
Registered Developer
 
Join Date: Jan 2012
Posts: 26
Default

I will not have control of the facet values or the titles in the final version.
I also have a very real requirement for displaying negative values.

Is there a way to change the upper and lower values?
Attached Images
File Type: png negitiveChart.png (71.0 KB, 20 views)
Reply With Quote
  #4  
Old 12th Mar 2012, 12:14
Isomorphic Isomorphic is offline
Administrator
 
Join Date: May 2006
Posts: 37,158
Default

Not sure what you mean by "not have control" over facetValues - there's no obstacle to providing blank titles whether facetValues are in advance or not.

3.1d builds have support for negative values, 3.0p don't (and we don't plan to add it). Neither branch currently allows manually setting gradations.
Reply With Quote
  #5  
Old 15th Mar 2012, 13:46
ls3674 ls3674 is offline
Registered Developer
 
Join Date: Sep 2011
Posts: 129
Default

Hey, so a few of us switched to the daily build to get the charting working as it should, however it breaks the application. We know you do not guarantee anything with dailies, so our question is this:

When will the next stable release be available? We have to make a decision to use another charting package or stay with this one as a result, because we cannot forgo the ability to show negative values to our users, it is an absolute requirement and a basic charting expectation.

Thank you
Reply With Quote
  #6  
Old 15th Mar 2012, 14:14
Isomorphic Isomorphic is offline
Administrator
 
Join Date: May 2006
Posts: 37,158
Default

Very roughly, 3.1 is planned for late April - this is not a guarantee and could change.

However as we say on smartclient.com/builds, your support applies to nightlies. If something has gone wrong in nightlies and you believe it's a bug, you should provide the usual information to help us fix it, because if it's a real bug then our huge test suite and all the users who routinely use nightlies haven't hit it. There's no indication it would be found and fixed for 3.1 (if it's a bug).
Reply With Quote
  #7  
Old 16th Mar 2012, 13:51
ls3674 ls3674 is offline
Registered Developer
 
Join Date: Sep 2011
Posts: 129
Default

Thanks for the update. I'll get with the developer who reported the problem and have them detail it on their support account.

Cheers,
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads
Thread Thread Starter Forum Replies Last Post
Charting Package and SmartGWT Validation tlazar1 Smart GWT Technical Q&A 1 4th Oct 2011 14:57
Testing charting functionality azuniga Technical Q&A 1 18th Jul 2011 09:24
Charting with Bluff rgrempel Technical Q&A 2 6th Jan 2010 22:41
Charting WeeJavaDude Technical Q&A 4 22nd May 2009 05:42
Flex charting senordhuff Technical Q&A 1 15th Feb 2008 09:40

© 2010,2011 Isomorphic Software. All Rights Reserved