I'm using a JFreeChart which I found in this link http://www.java2s.com/Code/Java/Chart/JFreeChartCategoryStepChartDemo.htm I have modified the code as given below.My problem is how i can change the values in the x-axis so that they don't start from the zero.

public class Chart1 extends JPanel {

    /**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	/**
     * Creates a new demo application.
     *
     * @param title  the frame title.
	 * @throws SQLException 
     */
    public Chart1(DefaultTableModel model,final double [][] data) throws SQLException {
        super();
       
        
      
        final CategoryDataset dataset = DatasetUtilities.createCategoryDataset(
            "Country ", "year ", data
        );
        
        
        // create the chart...
        final JFreeChart chart = createChart(dataset);
        final ChartPanel chartPanel = new ChartPanel(chart);
        chartPanel.setPreferredSize(new Dimension(500, 270));
        chartPanel.setEnforceFileExtensions(false);
        
        
        this.add(chartPanel);
    }


    /**
     * Creates a chart.
     * 
     * @param dataset  the dataset.
     * 
     * @return The chart.
     */
    private JFreeChart createChart(final CategoryDataset dataset) {
            
        final CategoryItemRenderer renderer = new CategoryStepRenderer(true);
        final CategoryAxis domainAxis = new CategoryAxis("Category");
        final ValueAxis rangeAxis = new NumberAxis("jiji");
        final CategoryPlot plot = new CategoryPlot(dataset, domainAxis, rangeAxis, renderer);
        final JFreeChart chart = new JFreeChart("Category Step Chart", plot);


        // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...

        // set the background color for the chart...
//        final StandardLegend legend = (StandardLegend) chart.getLegend();
  //      legend.setAnchor(StandardLegend.SOUTH);
        
        chart.setBackgroundPaint(Color.white);
        
//        plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 5.0, 5.0, 5.0, 5.0));
        
        plot.setBackgroundPaint(Color.yellow);
        plot.setDomainGridlinesVisible(true);
        plot.setDomainGridlinePaint(Color.white);
        plot.setRangeGridlinesVisible(true);
        plot.setRangeGridlinePaint(Color.white);
        
        domainAxis.setCategoryLabelPositions(CategoryLabelPositions.DOWN_90);
        domainAxis.setLowerMargin(0.0);
        domainAxis.setUpperMargin(0.0);
        domainAxis.addCategoryLabelToolTip("Type 1", "The first type.");
        domainAxis.addCategoryLabelToolTip("Type 2", "The second type.");
        domainAxis.addCategoryLabelToolTip("Type 3", "The third type.");
        
        rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
        rangeAxis.setLabelAngle(0 * Math.PI / 2.0);
        // OPTIONAL CUSTOMISATION COMPLETED.
        
        return chart;
        
    }

Your domain axis (x-axis) should display the categories you've supplied. It's not a range of values, it's a discrete set.

how can i assign my discrete set to this? meaning in which variable..

You mean i should replace "year" with values in here?

final CategoryDataset dataset = DatasetUtilities.createCategoryDataset(
"Country ", "year ", data
);

Yes, you can use this method to create any series and category labels you want

final CategoryDataset dataset = DatasetUtilities.createCategoryDataset(
            new String[]{"a","b","c"}, new String[]{"bob","mary","sue"}, data
        );

That produces data series a,b,c and the domain categories bob,mary,sue along the x-axis.

This question has already been answered. Start a new discussion instead.