c# - ILNumerics: manually created ticks -


i created manual ticks shown on ilnumerics page: http://ilnumerics.net/axis-configuration.html. let take first example dates on x-axis. problem following:

in program want use interactive mouse zoom , drag. if tick labels , gridlines drawn out of left , right borders of plotcube. (also in mentioned example.)

i found out can fix gridline problem using clipping property of plotcube. panel size looks this:

        plotcub.clipping = new ilclipparams{             plane0 = new vector4(1, 0, 0, 0.63f),             plane1 = new vector4(-1, 0, 0, 0.63f)         }; 

but tick labels still drawn outside borders. workaround right place panels on left , right of plotcube. guess there better way deal that?!?

and problem clipping fits current panel size. want change panel size @ runtime , clipping doesn't fit more. didn't find out how correct factors clipping. or there another/better solution?

thanks in advance help!

edit: sorry, seems blind!! used tickcreationfunc @ http://ilnumerics.net/axis-configuration.html#ticks-configuration in dynamic ticks example. works fine! faced new problems:
when use tickcreationfunc in example ticks updated whenever zoom or drag scene. function returns positions of ticks. labeltransformfunc can manipulate text of label , defaultlabel can set font , anchor of ticks.
i'm searching way define anchor of individual ticks because need place ticks on 2 heights alternately not readable otherwise close together. there way that?? here minimized example of code:

private void ilpanel1_load(object sender, eventargs e) {     // create base data:     ilarray<double> = new double[,] { { 1, 4, 0 }, { 10, 12, 0 }, { 100, 10, 0 }, { 1000, 18, 0 }, { 10000, 15, 0 } };     // create line plot , keep reference     var lineplot = new illineplot(ilmath.tosingle(a));      ilpanel1.scene.add(new ilplotcube{         children = { lineplot },         axes = {             xaxis = {                 ticks = {                     tickcreationfunc = (min, max, count) => {                         list<float> ret = new list<float>();                         using (ilscope.enter())                         {                             // example ticks                             (double = 0; <= 10000; += 100)                             {                                 // ticks within plotcube limits                                 if ((float)ilmath.log10(i) >= min && (float)ilmath.log10(i) <= max)                                 {                                     float mval = (float)ilmath.log10(i);                                     // add if not allready in collection                                     if (!ret.contains(mval))                                         ret.add(mval);                                 }                             }                         }                         return ret;                     },                     labeltransformfunc = (ind, val) => {                         string s = "" + (float)(ilmath.round(ilmath.pow(10.0, convert.tosingle(val.tostring("f3"))) * 10) / 10.0);                         return s;                     },                     defaultlabel = {font = new font("profont", 5), anchor = new pointf(0.5f, -1.0f)},                },            },        },        scalemodes = { xaxisscale = axisscale.logarithmic },    }); 

i can't read or manipulate ticks within functions , don't know that.

because of tried use tickcreationfuncex visualstudio warned me tickcreationfunc no longer date?! function return complete iltickcollection anchors set needed them.
function doesn't seem called plotcube. did forget something? here wrote. replaced tickcreationfunc, labeltransformfunc , defaultlabel this:

tickcreationfuncex = (min, max, count, axis, scale) => {     ilist<iltick> ret = new list<iltick>();     // example ticks     (double = 0; <= 10000; += 100)     {         // ticks within plotcube limits         if ((float)ilmath.log10(i) >= min && (float)ilmath.log10(i) <= max)         {             string s = "" + i;             float mval = (float)ilmath.log10(i);             ret.add(new iltick(mval, s));          }     }     font f = new font("profont", 5);     (int = 0; < ret.count; i++)     {         ret[i].label.font = f;         if (i % 2 == 1)             ret[i].label.anchor = new pointf(0.5f, -1.0f);         else             ret[i].label.anchor = new pointf(0.5f, 0.25f);     }     return ret; } 

when debug first program version see tickcreationfunc called on , on again in second tickcreationfuncex never called. doing wrong?

thank in advance help!


Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -