2013-02-04 4 views
0

C# 프로그래밍을 처음 사용합니다. 나는 회사에서 일하고있다, 누군가는 약간 업무를 완료하고 도표 부속에 맡겼다. 이제 내가해야만 해.다중 축 생성 Teechart

저는 C#에서 steema 차트를 사용하고 있습니다. 차트의 왼쪽에 여러 축 (y 축)이 있고 모든 축에 대해 x 축을 생성하고 싶습니다. 가장 안쪽의 각 축은 다른 축 길이가됩니다.

다른 센서에 대해 6 개의 확인란을 만들었습니다. 확인란을 선택하면 기본 길이로 축이 표시됩니다. 확인란을 만들었지 만 축 길이를 설정할 수 없으며 여러 축을 그릴 수 없습니다.

나는 이것이 올바른 방법인지 묻지 않습니까? 내가 틀렸다면 나를 용서해 주시겠습니까? 나는 많은 정보를 제공하지 않았다면 나에게 그것을 요청할 것입니다.

첨부 된 이미지와 같이 차트 유형을 그려야합니다. X 축 (시스템 시간)은 모든 시리즈에 공통적이며 Y 축은 각 시리즈마다 다릅니다. 모든 시리즈에 대한 첵크 박스가 있으므로 체크 박스를 선택하면 시리즈 Y 축이 기본 축 범위 (예 : min (0) 및 max (1000))로 표시됩니다. chart

미리 감사드립니다.

답변

1

Steema Support 포럼에서 비슷한 것이 있습니다. 보기 here.

나는 여기에 동일한 코드를 게시 :

int nSeries = 3; 
    private void InitializeChart() 
    { 
     tChart1.Aspect.View3D = false; 
     tChart1.Header.Visible = false; 
     tChart1.Legend.Alignment = LegendAlignments.Bottom; 
     for (int i = 0; i < nSeries; i++) 
     { 
      new Steema.TeeChart.Styles.Line(tChart1.Chart); 
      tChart1.Axes.Custom.Add(new Steema.TeeChart.Axis(tChart1.Chart)); 
      tChart1[i].CustomVertAxis = tChart1.Axes.Custom[i]; 
      tChart1.Axes.Custom[i].AxisPen.Color = tChart1[i].Color; 
      tChart1.Axes.Custom[i].Grid.Visible = false; 
      tChart1.Axes.Custom[i].Title.Visible = true; 
      tChart1.Axes.Custom[i].Title.Caption = "Series" + i.ToString(); 
      tChart1[i].FillSampleValues(20); 
      tChart1.Axes.Custom[i].PositionUnits = PositionUnits.Pixels; 
     } 

     tChart1.Panel.MarginUnits = PanelMarginUnits.Pixels; 
     tChart1.Draw(); 
     PlaceAxes(0, 0, 0, 0, 0); 
     tChart1.Draw(); 
    } 

    private void PlaceAxes(int nSeries, int NextXLeft, int NextXRight, int MargLeft, int MargRight) 
    { 
     const int extraPos = 12; 
     const int extraMargin = 105; 
     //Variable 
     int MaxLabelsWidth; 
     int lenghtTicks; 
     int extraSpaceBetweenTitleAndLabels; 
     if (tChart1[nSeries].Active) 
     { 
      MaxLabelsWidth = tChart1.Axes.Custom[nSeries].MaxLabelsWidth(); 
      lenghtTicks = tChart1.Axes.Custom[nSeries].Ticks.Length; 
      extraSpaceBetweenTitleAndLabels = (tChart1.Axes.Custom[nSeries].Title.Width);//- tChart1.Axes.Custom[nSeries].MaxLabelsWidth()); 
      if (tChart1.Axes.Custom[nSeries].OtherSide) 
      { 
       tChart1.Axes.Custom[nSeries].RelativePosition = NextXRight; 
       NextXRight = NextXRight - (MaxLabelsWidth + lenghtTicks + extraSpaceBetweenTitleAndLabels + extraPos); 
       MargRight = MargRight + extraMargin; 
      } 

      else 
      { 
       tChart1.Axes.Custom[nSeries].RelativePosition = NextXLeft; 
       NextXLeft = NextXLeft - (MaxLabelsWidth + lenghtTicks + extraSpaceBetweenTitleAndLabels + extraPos); 
       MargLeft = MargLeft + extraMargin; 
      } 

      tChart1.Panel.MarginLeft = MargLeft; 
      tChart1.Panel.MarginRight = MargRight; 

      nSeries++; 

      if (nSeries <= tChart1.Series.Count - 1) 
      { 
       PlaceAxes(nSeries, NextXLeft, NextXRight, MargLeft, MargRight); 
      } 
     } 
    } 
+0

나는 위의 코드를 사용하여 오류가 발생하고,() 메소드 intilizechart에 존재하지 않는 "nSeries"입니다; PlaceAxes() 메소드에서 선언했습니다. 어떻게 부를 수 있습니까? 전 세계적으로 선언 할 수 있습니까? – PRV

+0

'nSeries'는 예제의 'int'(시리즈 수)입니다. 회신 코드를 편집하여 초기화했습니다. – Yeray

관련 문제