This is a migrated thread and some comments may be shown as answers.

Issues with Chart Gridlines showing up

2 Answers 68 Views
Chart
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Mike
Top achievements
Rank 1
Mike asked on 09 Jul 2014, 09:01 AM
Hi,

I'm seeing some issues where the Chart's XY gridlines do not always show up.

When I have a DateTimeCategoricalAxis as the horizontal axis (set on the chart via setHorizontalAxis) and a vertical axis set on chart as well, only the horizontal gridlines seem to show up.

Here is a screenshot: https://www.dropbox.com/s/ko73sqhv81n72e1/2.png

I am setting the gridlines on the chart as follows:

CartesianChartGrid grid = new CartesianChartGrid(_context);
        grid.setMajorXLinesRenderMode(GridLineRenderMode.INNER);
        grid.setMajorYLinesRenderMode(GridLineRenderMode.INNER);
        grid.setMajorXLineDashArray(new float[] {1, 8});
        grid.setMajorYLineDashArray(new float[] {1, 8});
        grid.setLineColor(Color.WHITE);
        grid.setMajorLinesVisibility(GridLineVisibility.XY);
        _chart.setGrid(grid);

Now the second problem I am seeing is that I tried removing the code to set vertical axis on the chart directly, and instead I set the vertical axis on a AreaSeries first and then add that AreaSeries to the chart.  I am following the 'Indicators' sample code which does the same thing and does not set vertical axis directly on the chart.  The chart renders fine but now neither horizontal nor vertical gridlines show up anymore.  I tried moving the above code (for setting the grid) to different places but no luck.

Any idea what is wrong?  For repro you can try to enable XY gridlines on the 'Indicators' sample code






2 Answers, 1 is accepted

Sort by
0
Mike
Top achievements
Rank 1
answered on 09 Jul 2014, 06:01 PM
After trying some different approaches, I can get the X gridlines working, but not both X and Y:

        // Enable Grid
        CartesianChartGrid grid = new CartesianChartGrid(_context);
        _chart.setGrid(grid);
        grid.setMajorXLineDashArray(new float[] {1, 8});
        grid.setMajorYLineDashArray(new float[] {1, 8});
        grid.setMajorYLinesRenderMode(GridLineRenderMode.INNER);
        grid.setLineThickness(1);
        grid.setLineColor(defaultSubtleColor);
        grid.setMajorLinesVisibility(GridLineVisibility.XY); // Only shows X, not Y
        grid.setStripLinesVisibility(GridLineVisibility.XY); // Only shows X, not Y
        //grid.setMajorLinesVisibility(GridLineVisibility.X); // Works
        //grid.setStripLinesVisibility(GridLineVisibility.X); // Works
0
Accepted
Victor
Telerik team
answered on 10 Jul 2014, 08:08 AM
Hello Mike,

I have answered you question in the support thread about the same issue. In a sentence, you need to set both axes to the chart itself for the grid lines/stripes to work.

Please write again if you have other questions.

Regards,
Victor
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Chart
Asked by
Mike
Top achievements
Rank 1
Answers by
Mike
Top achievements
Rank 1
Victor
Telerik team
Share this question
or