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

how draw vertical grid?

1 Answer 62 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.
Seung-Ho
Top achievements
Rank 1
Seung-Ho asked on 26 Nov 2014, 10:24 AM

my code is.. :
 
CategoricalAxis horizontalAxis = new CategoricalAxis();
horizontalAxis.setVerticalLocation(AxisVerticalLocation.BOTTOM);
lineSeries_Temperature.setHorizontalAxis(horizontalAxis);

CategoricalAxis horizontalAxis_top = new CategoricalAxis();
horizontalAxis_top.setVerticalLocation(AxisVerticalLocation.TOP);

LinearAxis verticalAxis = new LinearAxis();
verticalAxis.setMaximum(maxTemperature);
verticalAxis.setMinimum(minTemperature);

chartView_line.setVerticalAxis(verticalAxis);


// Grid 
CartesianChartGrid grid = new CartesianChartGrid();
grid.setMajorYLinesRenderMode(GridLineRenderMode.ALL);
grid.setMajorXLinesRenderMode(GridLineRenderMode.ALL);
grid.setMajorLinesVisibility(GridLineVisibility.XY);
grid.setStripLinesVisibility(GridLineVisibility.XY);
chartView_line.setGrid(grid);








1 Answer, 1 is accepted

Sort by
0
Victor
Telerik team
answered on 27 Nov 2014, 11:39 AM
Hello Seung,

Thanks for writing.
To draw vertical grid lines, you need to set your axes on the chart, not on the series. This is crucial since the grid does not know which series to get axes from if the axes are set on the series. Once the axes are set on the chart object, you just have to set the grid to render only vertical lines. For example:
CartesianChartGrid grid = new CartesianChartGrid();
grid.setMajorLinesVisibility(GridLineVisibility.X);
grid.setCanApplyPalette(false);
this.chartView.setGrid(grid);
You need to stop the palette from applying because otherwise it will overwrite your settings.

Please write again if you have more 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
Seung-Ho
Top achievements
Rank 1
Answers by
Victor
Telerik team
Share this question
or