다른 절차에서 얻은 데이터로 채울 차트를 그립니다. 확대 및 축소 버튼 두 개를 만들고 싶습니다. 나는 AxisX.ScaleView에서 다른 기능을 사용할 수 있다는 것을 알았고, 나는 그것들과 조금씩 놀고있다. 나는 거의 다 왔지만 차트를 그리는 순간 문제가 있습니다. 이미지 1을 보면 다른 절차를 실행하고 처음으로 그려 본 차트입니다. 확대 및 축소를 수행하면 마지막 막대 (이미지 2의 22 번째 주)가 반으로 잘리고 원래 크기로 이동하지 않습니다.확대/축소를 조작하는 차트 그리기
줌을 만들기 위해 축 X의 시작과 끝 위치를 어떻게 조작 할 수 있습니까? 누구든지 차트 영역의 시작과 끝의 initian 값을 얻는 방법을 알고 있습니까? 나는 차트의 줌을 내 함수의 코드를 삽입 :
private void setSize(int zoom)
{
int blockSize = (Convert.ToInt32(tbZoom.Text) + zoom)/100;
// set view range to [0,max]
chartReport.ChartAreas[0].AxisX.Minimum = 0;
chartReport.ChartAreas[0].AxisX.Maximum = chartReport.Series[0].Points.Count;
// enable autoscroll
chartReport.ChartAreas[0].CursorX.AutoScroll = true;
chartReport.ChartAreas[0].CursorX.IsUserSelectionEnabled = true;
// let's zoom to [0,blockSize] (e.g. [0,100])
chartReport.ChartAreas[0].AxisX.ScaleView.Zoomable = true;
chartReport.ChartAreas[0].AxisX.ScaleView.SizeType = DateTimeIntervalType.Number;
int actualHeight = chartReport.Height;
int actualWidth = chartReport.Width;
int position = 0;
int size = blockSize;
chartReport.ChartAreas[0].AxisX.ScaleView.Zoom(position, size);
// disable zoom-reset button (only scrollbar's arrows are available)
chartReport.ChartAreas[0].AxisX.ScrollBar.ButtonStyle = ScrollBarButtonStyles.SmallScroll;
// set scrollbar small change to blockSize (e.g. 100)
chartReport.ChartAreas[0].AxisX.ScaleView.SmallScrollSize = blockSize;
tbZoom.Text = (blockSize * 100).ToString();
}
그게 전부입니다. 차이를 만들만한 작은 것이 될 것이라고 생각했습니다. 답변을 수락했습니다! –