我已经将数据在PivotTable1控件中正确显示,但是请问怎样才能更改里面数据的颜色?
比如某一列数值小于1000,颜色变为红色请详细指出,谢谢

解决方案 »

  1.   

    使用 ChSegment 对象表示格式映射中的一段。格式映射中的每一段可以独立于其他段设置格式。下列方法或属性返回 ChSegment 对象。ChSegments 对象的 Add 方法ChSegments 对象的 Item 属性使用 ChSegments 对象的 Add 方法新建一段。使用由 Begin 属性返回的 ChSegmentBoundary 对象的属性设置段的开始格式。使用由 End 属性返回的 ChSegmentBoundary 对象的属性设置段的结束格式。示例
    本示例将 Chartspace1 绑定到罗斯文数据库中的 Order Details 表,然后创建两个段。第一段突出显示图表第一个系列的低 10% 数值。第二段突出显示图表第一个系列的高 20% 数值。Sub Window_Onload()    Dim serseries1
        Dim segBottom10Pct
        Dim segTop20Pct
        Dim chConstants    Set chConstants = ChartSpace1.Constants    ' The following two lines of code bind Chartspace1 to the Order Details table in the
        ' Northwind SQL Server database.    ChartSpace1.ConnectionString = "Provider=SQLOLEDB.1;persist Security Info=TRUE;" & _
                                       "Integrated Security=SSPI;Initial Catalog=Northwind;Data Source=" & _
                                       "ServerName;"    ChartSpace1.DataMember = "Order Details"    ' The following two lines of code bind Chartspace1 to the Quantity and ProductID fields
        ' in the Order details table.
        ChartSpace1.SetData chConstants.chDimCategories, chConstants.chDataBound, "ProductID"
        ChartSpace1.SetData chConstants.chDimValues, chConstants.chDataBound, "Quantity"    ' Create a format map.
        ChartSpace1.SetData chConstants.chDimFormatValues, chConstants.chDataBound, "Quantity"    ' Set a variable to the first series in the first chart in Chartspace1.
        Set serseries1 = ChartSpace1.Charts(0).SeriesCollection(0)    ' Add a segment to the format map. This segment will
        ' represent the bottom 10% of values in the chart.
        Set segBottom10Pct = serseries1.FormatMap.Segments.Add    ' Measure the segment boundaries based upon a percentage.    segBottom10Pct.Begin.ValueType = chConstants.chBoundaryValuePercent
        segBottom10Pct.End.ValueType = chConstants.chBoundaryValuePercent    ' Set the beginning value to 0%, and the ending value to 10%
        segBottom10Pct.Begin.Value = 0
        segBottom10Pct.End.Value = 0.1    ' Format the interior of the matching values.
        segBottom10Pct.Begin.Interior.Color = "red"
        segBottom10Pct.End.Interior.Color = "red"       ' Add a segment to the format map. This segment will
        ' represent the top 20% of values in the chart.    Set segTop20Pct = serseries1.FormatMap.Segments.Add    ' Measure the segment boundaries based upon a percentage.
        segTop20Pct.Begin.ValueType = chConstants.chBoundaryValuePercent
        segTop20Pct.End.ValueType = chConstants.chBoundaryValuePercent    ' Set the beginning value to 80%, and the ending value to 100%.
        segTop20Pct.Begin.Value = 0.8
        segTop20Pct.End.Value = 1    ' Format the interior of the matching values.
        segTop20Pct.Begin.Interior.Color = "green"
        segTop20Pct.End.Interior.Color = "green"End Sub