Hybrid View

  1. #1
    Sencha User
    Join Date
    Feb 2013
    Location
    Russian federation, Smolensk
    Posts
    38
    Vote Rating
    0
    Answers
    5
    Mike_javaJunior is on a distinguished road

      0  

    Default Answered: Charts. creating and other

    Answered: Charts. creating and other


    Hi everyone.
    I'm trying to make a simple example of chart just to see it works but it doesn't.
    help me please. here is the code:
    Code:
    public class ExampleChart extends ContentPanel{
    
        public ContentPanel createChart(){
    
    
            setHeading("Horizontal Bar chart");
            setFrame(true);
            setSize(550, 400);
            setLayout(new FitLayout());
    
    
            String url = "/gxt/chart/open-flash-chart.swf";
            final Chart chart = new Chart(url);
    
    
            chart.setBorders(true);
            chart.setChartModel(getHorizontalBarChartModel());
    
    
            add(chart);
            return this;
        }
    
    
        public ChartModel getHorizontalBarChartModel()
        {
            //Create a ChartModel with the Chart Title and some style attributes
            ChartModel cm = new ChartModel("Students by Department", "font-size: 14px; font-family:      Verdana; text-align: center;");
    
    
            XAxis xa = new XAxis();
            //set the maximum, minimum and the step value for the X axis
            xa.setRange(0, 200, 50);
            cm.setXAxis(xa);
    
    
            YAxis ya = new YAxis();
            //Add the labels to the Y axis
            ya.addLabels("CSE", "EEE", "CE", "ME","CHE");
            ya.setOffset(true);
            cm.setYAxis(ya);
    
    
            //create a Horizontal Bar Chart object and add bars to the object
            HorizontalBarChart bchart = new HorizontalBarChart();
            bchart.setTooltip("#val#Students");
            bchart.addBars(new HorizontalBarChart.Bar(60, "#ffff00"));
            //different color for different bars
            bchart.addBars(new HorizontalBarChart.Bar(180, "#0000ff"));
            bchart.addBars(new HorizontalBarChart.Bar(180, "#00ff00"));
            bchart.addBars(new HorizontalBarChart.Bar(120, "#ff0000"));
            bchart.addBars(new HorizontalBarChart.Bar(120, "#333ccc"));
    
    
            //add the bchart as the Chart Config of the ChartModel
            cm.addChartConfig(bchart);
            cm.setTooltipStyle(new ToolTip(ToolTip.MouseStyle.FOLLOW));
            return cm;
        }
    
    
    }
    I've added a string
    Code:
     <script type="text/javascript" language='javascript' src='/gxt/flash/swfobject.js'></script>
    to the .html file of my project and I've added
    Code:
     <inherits name="com.extjs.gxt.charts.Chart"/>
    to the .gwt.xml file.
    as a result I don't see anything. It shows only empty frame with the heading. I'm shure that swfobject.js and open-flash-chart.swf are in their places.
    so help me please

  2. OMG!!! it's so fun...))) I've forgotten I work with flash and I didn't have adobe flash plugin for the browser))) So, again I worked it out myself. It's very useful to post the porblem to the frum. As one of the members of this forum said, you can look at your problem from the other side.

  3. #2
    Sencha User
    Join Date
    Feb 2013
    Location
    Russian federation, Smolensk
    Posts
    38
    Vote Rating
    0
    Answers
    5
    Mike_javaJunior is on a distinguished road

      0  

    Default


    OMG!!! it's so fun...))) I've forgotten I work with flash and I didn't have adobe flash plugin for the browser))) So, again I worked it out myself. It's very useful to post the porblem to the frum. As one of the members of this forum said, you can look at your problem from the other side.