예제 #1
0
        private void CheckItemRenderingCapability(IEnumerable <string> graphItems)
        {
            //boolean attributes can't be rendered in Log scale graphs. (0 is not a valid value)
            var booleanItemsOnLogScale = CurveList.Where(x => x.GetYAxis(this).Scale.IsLog)
                                         .Select(x => x.Tag.ToString())
                                         .Intersect(graphItems.Where(x => IsBooleanItem(x)));

            string msg = null;

            if (booleanItemsOnLogScale.Count() == 1)
            {
                msg = string.Format("\"{0}\" is a boolean value which can't be rendered in a Log scale graph. Please change the format of the Y-axis for the item to be rendered correctly.", booleanItemsOnLogScale.First());
            }
            else if (booleanItemsOnLogScale.Count() > 1)
            {
                string itemNames = string.Join("\", \"", booleanItemsOnLogScale.ToArray(), 0, booleanItemsOnLogScale.Count() - 1) + "\" and \"" + booleanItemsOnLogScale.Last();
                msg = string.Format("\"{0}\" are boolean values which can't be rendered in a Log scale graph. Please change the format of the Y-axis for the items to be rendered correctly.", itemNames);
            }

            if (msg != null)
            {
                MessageBox.Show(msg, "Rendering incompability warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }