Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    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 Files

    #2
    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.

    Comment


      #3
      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 Files

      Comment


        #4
        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.

        Comment


          #5
          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

          Comment


            #6
            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).

            Comment


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

              Cheers,

              Comment

              Working...
              X