CustomCategoryAxis

Oystein Bjorke fa 10 anys 0
This discussion was imported from CodePlex

ckoo wrote at 2012-07-17 04:16:

Hi Objo,

We have implemented a CutomCategoryAxis, which allows you specify the range of the labels, mainly to use with the RectagularBarSeries, but it also works well with LineSeries if you want to create custom regions.

Anyway, we had to create a new class to store label information, such as the Name, From value and To value.

class AxisLabel
{
    public string Name {get;set;}
    public double From {get;set;}
    public double To {get;set;}
}

You can can then add AxisLabels to the CustomCategoryAxis to have labels defined with custom start and end positions.

The question is, we think it is probably better to merge this into the CategoryAxis and refactor it. Since the CategoryAxis only takes a String[] of category names, we can assign "From" and "To" values to the AxisLabel based on the "TotalWidthPerCategory" values. What do you think?

This would also make it easier to add mouse events to the category axis and return the category range based on which label has been clicked. In fact is there a way of merging the AxisLabel with a TextAnnotation class?


objo wrote at 2012-08-09 00:37:

I'll add this to the issue tracker. Need to think more how (or if) this can be implemented.

See http://oxyplot.codeplex.com/workitem/9976