2010-12-10 4 views
1

필터 조건에 따라 wpf 툴킷 줄 시리즈 차트의 x 축을 변경하고 싶습니다. 필터에는 1) 오늘보기 2) 주보기 3) 달 표시와 같은 3 개의 체크 박스가 있습니다. 오늘보기를 클릭하면 데이터베이스에서 오늘의 기록을 볼 수 있으며 X 축은 오전 9 시부 터 오후 11 시까 지 오후 3시, 오후 5시, 오후 7시, 오후 9시, 오후 11시, 오전 1시, 오전 3시, 오전 5시, 오전 7시 사이에 나타나야합니다. 주 표시를 클릭하면 일요일부터 토요일까지의 현재 주간 날짜가 표시됩니다. Show Month (달 표시)를 클릭하면 x 축에 1에서 31까지 표시됩니다. DateTime 속성을 X 축의 IndependentValuePath에 바인딩하고 있습니다. 그리고 필터 변경에 대한 내 데이터 액세스의 메소드 호출 중입니다. mvvm을 사용하여 wpf 라인 시리즈 차트에서이를 수행하는 방법.필터 기준에 따라 wpf 꺾은 선형 차트의 x 축을 사용자 지정하십시오. C# wpf

친절히 제안 하시겠습니까?

감사

+0

친절하게 도움이 되나요? – Tarun

답변

1

당신은 당신의 x 축 스타일의 체크 박스의 각각에 대한 datatrigger을 만들어야합니다.

<chartingToolkit:Chart.Axes> 
         <chartingToolkit:DateTimeAxis x:Name="LevelsDateTimeAxis" Orientation="X" Minimum="{Binding ElementName=PatientWindow, Path=MinimumTime}" Maximum="{Binding ElementName=PatientWindow, Path=MaximumTime}"> 
          <chartingToolkit:DateTimeAxis.Style> 
           <Style TargetType="{x:Type chartingToolkit:DateTimeAxis}"> 
            <Style.Triggers> 
             <DataTrigger Binding="{Binding ElementName=WeekCheckbox, Path=IsChecked}" 
                Value="True"> 
              <Setter Property="IntervalType" 
                Value="Days" /> 
              <!-- You might need to adjust the Interval to 1 Here --> 
             </DataTrigger> 
             <!-- Continue With the Next Checkbox --> 
            </Style.Triggers> 
           </Style> 
          </chartingToolkit:DateTimeAxis.Style> 
         </chartingToolkit:DateTimeAxis> 
관련 문제