示例#1
0
 // This is only used stacked bar graphs
 public void UpdateTotalValues()
 {
     if (pointValuesChanged)
     {
         // Find max number points
         int maxNumValues = 0;
         for (int j = 0; j < theGraph.lineSeries.Count; j++)
         {
             if (!theGraph.activeInHierarchy(theGraph.lineSeries[j]))
             {
                 continue;
             }
             WMG_Series theSeries = theGraph.lineSeries[j].GetComponent <WMG_Series>();
             if (maxNumValues < theSeries.pointValues.Count)
             {
                 maxNumValues = theSeries.pointValues.Count;
             }
         }
         // Update total values
         for (int i = 0; i < maxNumValues; i++)
         {
             if (theGraph.TotalPointValues.Count <= i)
             {
                 theGraph.TotalPointValues.Add(0);
             }
             theGraph.TotalPointValues[i] = 0;
             for (int j = 0; j < theGraph.lineSeries.Count; j++)
             {
                 if (!theGraph.activeInHierarchy(theGraph.lineSeries[j]))
                 {
                     continue;
                 }
                 WMG_Series theSeries = theGraph.lineSeries[j].GetComponent <WMG_Series>();
                 if (theSeries.pointValues.Count > i)
                 {
                     if (theGraph.orientationType == WMG_Axis_Graph.orientationTypes.vertical)
                     {
                         theGraph.TotalPointValues[i] += (theSeries.pointValues[i].y - theGraph.yAxisMinValue);
                     }
                     else
                     {
                         theGraph.TotalPointValues[i] += (theSeries.pointValues[i].y - theGraph.xAxisMinValue);
                     }
                 }
             }
         }
     }
 }
	public void subscribeToEvents(bool val) {
		for (int j = 0; j < theGraph.lineSeries.Count; j++) {
			if (!theGraph.activeInHierarchy(theGraph.lineSeries[j])) continue;
			WMG_Series aSeries = theGraph.lineSeries[j].GetComponent<WMG_Series>();
			if (val) {
				aSeries.SeriesDataChanged += SeriesDataChangedMethod;
			}
			else {
				aSeries.SeriesDataChanged -= SeriesDataChangedMethod;
			}
		}
	}